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

Method test_api_keys

tests/sentry/api/test_authentication.py:957–973  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

955 assert auth_token.audit_log_data == token.get_audit_log_data()
956
957 def test_api_keys(self) -> None:
958 ak = self.create_api_key(organization=self.organization, scope_list=["projects:read"])
959 with assume_test_silo_mode(SiloMode.CELL):
960 akr = ApiKeyReplica.objects.get(apikey_id=ak.id)
961
962 for token in [ak, akr]:
963 auth_token = AuthenticatedToken.from_token(token)
964
965 assert auth_token is not None
966 assert auth_token.entity_id == ak.id
967 assert auth_token.user_id is None
968 assert is_api_key_auth(token) and is_api_key_auth(auth_token)
969 assert auth_token.organization_id == self.organization.id
970 assert auth_token.application_id is None
971 assert auth_token.allowed_origins == token.get_allowed_origins()
972 assert auth_token.scopes == token.get_scopes()
973 assert auth_token.audit_log_data == token.get_audit_log_data()
974
975 def test_org_auth_tokens(self) -> None:
976 oat = OrgAuthToken.objects.create(

Callers

nothing calls this directly

Calls 8

assume_test_silo_modeFunction · 0.90
is_api_key_authFunction · 0.90
from_tokenMethod · 0.80
getMethod · 0.65
create_api_keyMethod · 0.45
get_allowed_originsMethod · 0.45
get_scopesMethod · 0.45
get_audit_log_dataMethod · 0.45

Tested by

no test coverage detected