@@ -199,7 +199,7 @@ def test_noncert_credential(self, user_mgt_app):
199199 auth .create_custom_token (MOCK_UID , app = user_mgt_app )
200200
201201 def test_sign_with_iam (self ):
202- options = {'serviceAccountId' : 'test-service-account' }
202+ options = {'serviceAccountId' : 'test-service-account' , 'projectId' : 'mock-project-id' }
203203 app = firebase_admin .initialize_app (
204204 testutils .MockCredential (), name = 'iam-signer-app' , options = options )
205205 try :
@@ -213,7 +213,7 @@ def test_sign_with_iam(self):
213213 firebase_admin .delete_app (app )
214214
215215 def test_sign_with_iam_error (self ):
216- options = {'serviceAccountId' : 'test-service-account' }
216+ options = {'serviceAccountId' : 'test-service-account' , 'projectId' : 'mock-project-id' }
217217 app = firebase_admin .initialize_app (
218218 testutils .MockCredential (), name = 'iam-signer-app' , options = options )
219219 try :
@@ -228,7 +228,9 @@ def test_sign_with_iam_error(self):
228228
229229 def test_sign_with_discovered_service_account (self ):
230230 request = testutils .MockRequest (200 , 'discovered-service-account' )
231- app = firebase_admin .initialize_app (testutils .MockCredential (), name = 'iam-signer-app' )
231+ options = {'projectId' : 'mock-project-id' }
232+ app = firebase_admin .initialize_app (testutils .MockCredential (), name = 'iam-signer-app' ,
233+ options = options )
232234 try :
233235 _overwrite_iam_request (app , request )
234236 # Force initialization of the signing provider. This will invoke the Metadata service.
@@ -248,7 +250,9 @@ def test_sign_with_discovered_service_account(self):
248250
249251 def test_sign_with_discovery_failure (self ):
250252 request = testutils .MockFailedRequest (Exception ('test error' ))
251- app = firebase_admin .initialize_app (testutils .MockCredential (), name = 'iam-signer-app' )
253+ options = {'projectId' : 'mock-project-id' }
254+ app = firebase_admin .initialize_app (testutils .MockCredential (), name = 'iam-signer-app' ,
255+ options = options )
252256 try :
253257 _overwrite_iam_request (app , request )
254258 with pytest .raises (ValueError ) as excinfo :
@@ -409,12 +413,6 @@ def test_project_id_env_var(self, env_var_app):
409413 claims = auth .verify_id_token (TEST_ID_TOKEN , env_var_app )
410414 assert claims ['admin' ] is True
411415
412- @pytest .mark .parametrize ('env_var_app' , [{}], indirect = True )
413- def test_no_project_id (self , env_var_app ):
414- _overwrite_cert_request (env_var_app , MOCK_REQUEST )
415- with pytest .raises (ValueError ):
416- auth .verify_id_token (TEST_ID_TOKEN , env_var_app )
417-
418416 def test_custom_token (self , auth_app ):
419417 id_token = auth .create_custom_token (MOCK_UID , app = auth_app )
420418 _overwrite_cert_request (auth_app , MOCK_REQUEST )
@@ -515,12 +513,6 @@ def test_project_id_env_var(self, env_var_app):
515513 claims = auth .verify_session_cookie (TEST_SESSION_COOKIE , app = env_var_app )
516514 assert claims ['admin' ] is True
517515
518- @pytest .mark .parametrize ('env_var_app' , [{}], indirect = True )
519- def test_no_project_id (self , env_var_app ):
520- _overwrite_cert_request (env_var_app , MOCK_REQUEST )
521- with pytest .raises (ValueError ):
522- auth .verify_session_cookie (TEST_SESSION_COOKIE , app = env_var_app )
523-
524516 def test_custom_token (self , auth_app ):
525517 custom_token = auth .create_custom_token (MOCK_UID , app = auth_app )
526518 _overwrite_cert_request (auth_app , MOCK_REQUEST )
0 commit comments