@@ -113,10 +113,10 @@ def test_start_empty(self, tmp_path):
113113 assert config .get_basic_auth ("foo" ) == (None , None )
114114 assert config .get_oidc_client_configs ("oeo.test" , "default" ) == (None , None )
115115
116- def test_basic_auth (self , tmp_path ):
116+ def test_basic_auth (self , tmp_path , time_machine ):
117+ time_machine .move_to ("2020-06-08T11:18:27Z" )
117118 config = AuthConfig (path = tmp_path )
118- with mock .patch .object (openeo .rest .auth .config , "utcnow_rfc3339" , return_value = "2020-06-08T11:18:27Z" ):
119- config .set_basic_auth ("oeo.test" , "John" , "j0hn123" )
119+ config .set_basic_auth ("oeo.test" , "John" , "j0hn123" )
120120 assert config .path .exists ()
121121 assert [p .name for p in tmp_path .iterdir ()] == [AuthConfig .DEFAULT_FILENAME ]
122122 with config .path .open ("r" ) as f :
@@ -137,10 +137,10 @@ def test_basic_auth_url_normalization(self, tmp_path, to_set, to_get):
137137 assert config .get_basic_auth (to_set ) == ("John" , "j0hn123" )
138138 assert config .get_basic_auth (to_get ) == ("John" , "j0hn123" )
139139
140- def test_oidc (self , tmp_path ):
140+ def test_oidc (self , tmp_path , time_machine ):
141+ time_machine .move_to ("2020-06-08T11:18:27Z" )
141142 config = AuthConfig (path = tmp_path )
142- with mock .patch .object (openeo .rest .auth .config , "utcnow_rfc3339" , return_value = "2020-06-08T11:18:27Z" ):
143- config .set_oidc_client_config ("oeo.test" , "default" , client_id = "client123" , client_secret = "$6cr67" )
143+ config .set_oidc_client_config ("oeo.test" , "default" , client_id = "client123" , client_secret = "$6cr67" )
144144 assert config .path .exists ()
145145 assert [p .name for p in tmp_path .iterdir ()] == [AuthConfig .DEFAULT_FILENAME ]
146146 with config .path .open ("r" ) as f :
@@ -157,10 +157,10 @@ def test_oidc(self, tmp_path):
157157 ("https://oeo.test" , "https://oeo.test/" ),
158158 ("https://oeo.test/" , "https://oeo.test" ),
159159 ])
160- def test_oidc_backend_normalization (self , tmp_path , to_set , to_get ):
160+ def test_oidc_backend_normalization (self , tmp_path , to_set , to_get , time_machine ):
161+ time_machine .move_to ("2020-06-08T11:18:27Z" )
161162 config = AuthConfig (path = tmp_path )
162- with mock .patch .object (openeo .rest .auth .config , "utcnow_rfc3339" , return_value = "2020-06-08T11:18:27Z" ):
163- config .set_oidc_client_config (to_set , "default" , client_id = "client123" , client_secret = "$6cr67" )
163+ config .set_oidc_client_config (to_set , "default" , client_id = "client123" , client_secret = "$6cr67" )
164164 for backend in [to_set , to_get ]:
165165 assert config .get_oidc_client_configs (backend , "default" ) == ("client123" , "$6cr67" )
166166 assert config .get_oidc_provider_configs (backend ) == {
0 commit comments