This repository was archived by the owner on Jun 13, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +36
-4
lines changed Expand file tree Collapse file tree 2 files changed +36
-4
lines changed Original file line number Diff line number Diff line change @@ -728,6 +728,41 @@ def test_repo_upload_token_not_available_config_setting_owner_not_admin(self):
728728
729729 assert data ["owner" ]["repository" ]["uploadToken" ] == TOKEN_UNAVAILABLE
730730
731+ @override_settings (HIDE_ALL_CODECOV_TOKENS = True )
732+ def test_repo_upload_token_not_available_config_setting_owner_is_anonymous (self ):
733+ owner = OwnerFactory (service = "gitlab" )
734+
735+ repo = RepositoryFactory (
736+ author = owner ,
737+ author__service = "gitlab" ,
738+ service_id = 12345 ,
739+ active = True ,
740+ private = False ,
741+ )
742+
743+ query = """
744+ query {
745+ owner(username: "%s") {
746+ repository(name: "%s") {
747+ ... on Repository {
748+ uploadToken
749+ }
750+ }
751+ }
752+ }
753+ """ % (
754+ owner .username ,
755+ repo .name ,
756+ )
757+
758+ data = self .gql_request (
759+ query ,
760+ variables = {"name" : repo .name },
761+ provider = "gitlab" ,
762+ )
763+
764+ assert data ["owner" ]["repository" ]["uploadToken" ] == TOKEN_UNAVAILABLE
765+
731766 @override_settings (HIDE_ALL_CODECOV_TOKENS = True )
732767 def test_repo_upload_token_not_available_config_setting_owner_is_admin (self ):
733768 owner = OwnerFactory (service = "gitlab" )
Original file line number Diff line number Diff line change @@ -210,10 +210,7 @@ def resolve_org_upload_token(
210210 should_hide_tokens = settings .HIDE_ALL_CODECOV_TOKENS
211211 current_owner = info .context ["request" ].current_owner
212212 command = info .context ["executor" ].get_command ("owner" )
213- if not current_owner :
214- is_owner_admin = False
215- else :
216- is_owner_admin = current_owner .is_admin (owner )
213+ is_owner_admin = current_owner .is_admin (owner )
217214 if should_hide_tokens and not is_owner_admin :
218215 return TOKEN_UNAVAILABLE
219216
You can’t perform that action at this time.
0 commit comments