@@ -83,6 +83,7 @@ def CheckDataInit(**kwargs):
83
83
cred_args ['quota_project_id' ] = None
84
84
expected_project = 'qp2'
85
85
ee .Initialize ()
86
+ self .assertEqual (4 , inits .call_count )
86
87
87
88
google_creds = google_creds .with_quota_project (None )
88
89
with self .assertRaisesRegex (ee .EEException , '.*no project found..*' ):
@@ -93,17 +94,29 @@ def CheckDataInit(**kwargs):
93
94
with moc (ee .ApiFunction , 'initialize' , side_effect = ee .EEException (msg )):
94
95
with self .assertRaisesRegex (ee .EEException , '.*no project found..*' ):
95
96
ee .Initialize ()
97
+ self .assertEqual (4 , inits .call_count )
98
+
99
+ oauth_project = '517222506229'
100
+ expected_project = oauth_project
101
+ msg = (
102
+ 'Caller does not have required permission to use project ' +
103
+ oauth_project
104
+ )
105
+ with moc (ee .ApiFunction , 'initialize' , side_effect = ee .EEException (msg )):
106
+ with self .assertRaisesRegex (ee .EEException , '.*no project found..*' ):
107
+ ee .Initialize (project = oauth_project )
108
+ self .assertEqual (5 , inits .call_count )
96
109
97
110
cred_args ['client_id' ] = '123456789-xxx'
98
111
cred_args ['refresh_token' ] = 'rt'
99
112
expected_project = '123456789'
100
113
ee .Initialize ()
101
- self .assertEqual (5 , inits .call_count )
114
+ self .assertEqual (6 , inits .call_count )
102
115
103
116
cred_args ['client_id' ] = '764086051850-xxx' # dummy usable-auth client
104
117
with self .assertRaisesRegex (ee .EEException , '.*no project found..*' ):
105
118
ee .Initialize ()
106
- self .assertEqual (5 , inits .call_count )
119
+ self .assertEqual (6 , inits .call_count )
107
120
108
121
def testCallAndApply (self ):
109
122
"""Verifies library initialization."""
0 commit comments