1212
1313from objectsapiclient .models import (
1414 LazyObjectTypeField ,
15- ObjectsClientConfiguration ,
15+ ObjectsAPIServiceConfiguration ,
1616 ObjectTypeField ,
1717)
1818
@@ -203,7 +203,7 @@ def test_get_choices_handles_exception_with_blank(
203203
204204
205205class TestLazyObjectTypeField :
206- @patch ("objectsapiclient.models.ObjectsClientConfiguration .get_solo" )
206+ @patch ("objectsapiclient.models.ObjectsAPIServiceConfiguration .get_solo" )
207207 @pytest .mark .parametrize (
208208 "include_blank,expected" , [(True , BLANK_CHOICE_DASH ), (False , [])]
209209 )
@@ -222,7 +222,7 @@ def test_get_choices_when_table_does_not_exist(
222222 assert choices == expected
223223 mock_get_solo .assert_called_once ()
224224
225- @patch ("objectsapiclient.models.ObjectsClientConfiguration .get_solo" )
225+ @patch ("objectsapiclient.models.ObjectsAPIServiceConfiguration .get_solo" )
226226 @pytest .mark .parametrize (
227227 "include_blank,expected" , [(True , BLANK_CHOICE_DASH ), (False , [])]
228228 )
@@ -240,24 +240,24 @@ def test_get_choices_when_operational_error(
240240 assert choices == expected
241241 mock_get_solo .assert_called_once ()
242242
243- @patch ("objectsapiclient.models.ObjectsClientConfiguration .get_solo" )
243+ @patch ("objectsapiclient.models.ObjectsAPIServiceConfiguration .get_solo" )
244244 @pytest .mark .parametrize (
245245 "include_blank,expected" , [(True , BLANK_CHOICE_DASH ), (False , [])]
246246 )
247247 def test_get_choices_when_services_not_configured (
248248 self , mock_get_solo , include_blank , expected
249249 ):
250- mock_config = Mock (spec = ObjectsClientConfiguration )
251- mock_config .objects_api_service_config = None
252- mock_config .object_type_api_service_config = None
250+ mock_config = Mock (spec = ObjectsAPIServiceConfiguration )
251+ mock_config .objects_api_client_config = None
252+ mock_config .objecttype_api_client_config = None
253253 mock_get_solo .return_value = mock_config
254254
255255 field = LazyObjectTypeField ()
256256 choices = field .get_choices (include_blank = include_blank )
257257
258258 assert choices == expected
259259
260- @patch ("objectsapiclient.models.ObjectsClientConfiguration .get_solo" )
260+ @patch ("objectsapiclient.models.ObjectsAPIServiceConfiguration .get_solo" )
261261 @pytest .mark .parametrize (
262262 "objects_api,object_type_api,include_blank,expected" ,
263263 [
@@ -275,9 +275,9 @@ def test_get_choices_when_only_one_service_configured(
275275 include_blank ,
276276 expected ,
277277 ):
278- mock_config = Mock (spec = ObjectsClientConfiguration )
279- mock_config .objects_api_service_config = objects_api
280- mock_config .object_type_api_service_config = object_type_api
278+ mock_config = Mock (spec = ObjectsAPIServiceConfiguration )
279+ mock_config .objects_api_client_config = objects_api
280+ mock_config .objecttype_api_client_config = object_type_api
281281 mock_get_solo .return_value = mock_config
282282
283283 field = LazyObjectTypeField ()
@@ -286,7 +286,7 @@ def test_get_choices_when_only_one_service_configured(
286286 assert choices == expected
287287
288288 @patch ("objectsapiclient.models.get_object_type_choices" )
289- @patch ("objectsapiclient.models.ObjectsClientConfiguration .get_solo" )
289+ @patch ("objectsapiclient.models.ObjectsAPIServiceConfiguration .get_solo" )
290290 @pytest .mark .parametrize (
291291 "include_blank,expected" ,
292292 [
@@ -297,9 +297,9 @@ def test_get_choices_when_only_one_service_configured(
297297 def test_get_choices_when_fully_configured (
298298 self , mock_get_solo , mock_get_choices , clear_cache , include_blank , expected
299299 ):
300- mock_config = Mock (spec = ObjectsClientConfiguration )
301- mock_config .objects_api_service_config = Mock ()
302- mock_config .object_type_api_service_config = Mock ()
300+ mock_config = Mock (spec = ObjectsAPIServiceConfiguration )
301+ mock_config .objects_api_client_config = Mock ()
302+ mock_config .objecttype_api_client_config = Mock ()
303303 mock_get_solo .return_value = mock_config
304304
305305 mock_get_choices .return_value = [
@@ -313,7 +313,7 @@ def test_get_choices_when_fully_configured(
313313 assert choices == expected
314314 mock_get_choices .assert_called_once ()
315315
316- @patch ("objectsapiclient.models.ObjectsClientConfiguration .get_solo" )
316+ @patch ("objectsapiclient.models.ObjectsAPIServiceConfiguration .get_solo" )
317317 def test_database_error_prevention_during_migrations (self , mock_get_solo ):
318318 """
319319 Test that LazyObjectTypeField prevents errors during migrations
@@ -328,16 +328,16 @@ def test_database_error_prevention_during_migrations(self, mock_get_solo):
328328 assert choices == BLANK_CHOICE_DASH
329329
330330 @patch ("objectsapiclient.models.get_object_type_choices" )
331- @patch ("objectsapiclient.models.ObjectsClientConfiguration .get_solo" )
331+ @patch ("objectsapiclient.models.ObjectsAPIServiceConfiguration .get_solo" )
332332 def test_prevents_unnecessary_http_requests_on_startup (
333333 self , mock_get_solo , mock_get_choices
334334 ):
335335 """
336336 Test that LazyObjectTypeField doesn't make HTTP requests when not configured
337337 """
338- mock_config = Mock (spec = ObjectsClientConfiguration )
339- mock_config .objects_api_service_config = None
340- mock_config .object_type_api_service_config = None
338+ mock_config = Mock (spec = ObjectsAPIServiceConfiguration )
339+ mock_config .objects_api_client_config = None
340+ mock_config .objecttype_api_client_config = None
341341 mock_get_solo .return_value = mock_config
342342
343343 field = LazyObjectTypeField ()
@@ -347,18 +347,18 @@ def test_prevents_unnecessary_http_requests_on_startup(
347347 mock_get_choices .assert_not_called ()
348348
349349 @patch ("objectsapiclient.models.get_object_type_choices" )
350- @patch ("objectsapiclient.models.ObjectsClientConfiguration .get_solo" )
350+ @patch ("objectsapiclient.models.ObjectsAPIServiceConfiguration .get_solo" )
351351 def test_uses_correct_field_names_when_checking_configuration (
352352 self , mock_get_solo , mock_get_choices
353353 ):
354354 """
355355 Regression test 1 for accessing non-existent config.objects_api_service
356- instead of config.objects_api_service_config : no API services configured
356+ instead of config.objects_api_client_config : no API services configured
357357 """
358358 # A SimpleNamespace object only has the exact attributes we set (unlike Mock)
359359 # Will raise AttributeError if code tries to access wrong attribute names
360360 mock_config = SimpleNamespace (
361- objects_api_service_config = None , object_type_api_service_config = None
361+ objects_api_client_config = None , objecttype_api_client_config = None
362362 )
363363
364364 mock_get_solo .return_value = mock_config
@@ -374,22 +374,22 @@ def test_uses_correct_field_names_when_checking_configuration(
374374 mock_get_choices .assert_not_called ()
375375
376376 @patch ("objectsapiclient.models.get_object_type_choices" )
377- @patch ("objectsapiclient.models.ObjectsClientConfiguration .get_solo" )
377+ @patch ("objectsapiclient.models.ObjectsAPIServiceConfiguration .get_solo" )
378378 def test_correctly_detects_configured_services (
379379 self , mock_get_solo , mock_get_choices , clear_cache
380380 ):
381381 """
382382 Regression test 2 for accessing non-existent config.objects_api_service
383- instead of config.objects_api_service_config : both API services configured
383+ instead of config.objects_api_client_config : both API services configured
384384 """
385385 mock_service = Mock ()
386386 mock_service .api_root = "https://example.com/api/"
387387
388388 # A SimpleNamespace object only has the exact attributes we set (unlike Mock)
389389 # Will raise AttributeError if code tries to access wrong attribute names
390390 mock_config = SimpleNamespace (
391- objects_api_service_config = mock_service ,
392- object_type_api_service_config = mock_service ,
391+ objects_api_client_config = mock_service ,
392+ objecttype_api_client_config = mock_service ,
393393 )
394394
395395 mock_get_solo .return_value = mock_config
0 commit comments