MCPcopy Create free account
hub / github.com/getsentry/sentry / test_with_invalid_auth

Method test_with_invalid_auth

tests/sentry/auth/test_access.py:787–807  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

785 assert result.has_global_access
786
787 def test_with_invalid_auth(self) -> None:
788 self.create_user()
789 organization = self.create_organization()
790 other_organization = self.create_organization()
791
792 team = self.create_team(organization=organization)
793 project = self.create_project(organization=organization, teams=[team])
794
795 request = self.make_request()
796 # Using an API key for another org should be invalid
797 request.auth = self.create_api_key(organization=other_organization, allowed_origins="*")
798 result = self.from_request(request, organization)
799
800 assert result == NoAccess()
801
802 assert result.team_ids_with_membership == frozenset({})
803 assert result.has_team_access(team) is False
804 assert result.project_ids_with_team_membership == frozenset({})
805 assert result.has_project_access(project) is False
806 assert result.has_project_membership(project) is False
807 assert result.has_global_access is False
808
809
810@all_silo_test

Callers

nothing calls this directly

Calls 11

NoAccessClass · 0.90
create_userMethod · 0.45
create_organizationMethod · 0.45
create_teamMethod · 0.45
create_projectMethod · 0.45
make_requestMethod · 0.45
create_api_keyMethod · 0.45
from_requestMethod · 0.45
has_team_accessMethod · 0.45
has_project_accessMethod · 0.45

Tested by

no test coverage detected