Skip to content

Commit b960441

Browse files
Refactor unit tests
1 parent 956198e commit b960441

2 files changed

Lines changed: 13 additions & 15 deletions

File tree

tests/unit/asyncio_client/test_rest_adapter.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ def test_check_http2_support_success(mock_logger):
141141
result = adapter.check_http2_support("https://example.com")
142142

143143
assert result is True
144-
mock_logger.info.assert_called()
145144

146145

147146
@patch("conductor.client.adapters.rest_adapter.logger")
@@ -161,7 +160,6 @@ def test_check_http2_support_failure(mock_logger):
161160
result = adapter.check_http2_support("https://example.com")
162161

163162
assert result is False
164-
mock_logger.info.assert_called()
165163

166164

167165
@patch("conductor.client.adapters.rest_adapter.logger")

tests/unit/orkes/test_async_authorization_client.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ async def test_get_user_with_empty_string(mocker, authorization_client, conducto
264264
mock = mocker.patch.object(UserResourceApi, "get_user")
265265
mock.return_value = conductor_user_adapter
266266
await authorization_client.get_user("")
267-
mock.assert_called_with(id=None)
267+
mock.assert_called_with(None)
268268

269269

270270
@pytest.mark.asyncio
@@ -279,7 +279,7 @@ async def test_delete_user_with_empty_string(mocker, authorization_client):
279279
from conductor.asyncio_client.http.api import UserResourceApi
280280
mock = mocker.patch.object(UserResourceApi, "delete_user")
281281
await authorization_client.delete_user("")
282-
mock.assert_called_with(id=None)
282+
mock.assert_called_with(None)
283283

284284

285285
@pytest.mark.asyncio
@@ -319,7 +319,7 @@ async def test_upsert_user_with_empty_string(mocker, authorization_client, condu
319319
upsert_req = UpsertUserRequestAdapter(name=USER_NAME, roles=["ADMIN"])
320320
mock.return_value = conductor_user_adapter
321321
await authorization_client.upsert_user("", upsert_req)
322-
mock.assert_called_with(id=None, upsert_user_request=upsert_req)
322+
mock.assert_called_with(None, upsert_req)
323323

324324

325325
@pytest.mark.asyncio
@@ -517,7 +517,7 @@ async def test_get_granted_permissions_for_user_with_empty_string(mocker, author
517517
mock = mocker.patch.object(UserResourceApi, "get_granted_permissions")
518518
mock.return_value = {"grantedAccess": []}
519519
await authorization_client.get_granted_permissions_for_user("")
520-
mock.assert_called_with(user_id=None)
520+
mock.assert_called_with(None)
521521

522522

523523
@pytest.mark.asyncio
@@ -532,7 +532,7 @@ async def test_create_access_key_empty_string_converts_to_none(mocker, authoriza
532532
"secret": "test-secret",
533533
}
534534
await authorization_client.create_access_key("")
535-
mock.assert_called_with(id=None)
535+
mock.assert_called_with(None)
536536

537537

538538
@pytest.mark.asyncio
@@ -545,7 +545,7 @@ async def test_add_role_to_application_user_empty_strings_convert_to_none(
545545

546546
mock = mocker.patch.object(ApplicationResourceApi, "add_role_to_application_user")
547547
await authorization_client.add_role_to_application_user("", "")
548-
mock.assert_called_with(application_id=None, role=None)
548+
mock.assert_called_with(None, None)
549549

550550

551551
@pytest.mark.asyncio
@@ -556,7 +556,7 @@ async def test_delete_access_key_empty_strings_convert_to_none(mocker, authoriza
556556

557557
mock = mocker.patch.object(ApplicationResourceApi, "delete_access_key")
558558
await authorization_client.delete_access_key("", "")
559-
mock.assert_called_with(application_id=None, key_id=None)
559+
mock.assert_called_with(None, None)
560560

561561

562562
@pytest.mark.asyncio
@@ -569,7 +569,7 @@ async def test_remove_role_from_application_user_empty_strings_convert_to_none(
569569

570570
mock = mocker.patch.object(ApplicationResourceApi, "remove_role_from_application_user")
571571
await authorization_client.remove_role_from_application_user("", "")
572-
mock.assert_called_with(application_id=None, role=None)
572+
mock.assert_called_with(None, None)
573573

574574

575575
@pytest.mark.asyncio
@@ -583,7 +583,7 @@ async def test_get_app_by_access_key_id_empty_string_converts_to_none(
583583
mock = mocker.patch.object(ApplicationResourceApi, "get_app_by_access_key_id")
584584
mock.return_value = extended_conductor_application_adapter
585585
await authorization_client.get_app_by_access_key_id("")
586-
mock.assert_called_with(access_key_id=None)
586+
mock.assert_called_with(None)
587587

588588

589589
@pytest.mark.asyncio
@@ -595,7 +595,7 @@ async def test_get_access_keys_empty_string_converts_to_none(mocker, authorizati
595595
mock = mocker.patch.object(ApplicationResourceApi, "get_access_keys")
596596
mock.return_value = []
597597
await authorization_client.get_access_keys("")
598-
mock.assert_called_with(id=None)
598+
mock.assert_called_with(None)
599599

600600

601601
@pytest.mark.asyncio
@@ -611,7 +611,7 @@ async def test_toggle_access_key_status_empty_strings_convert_to_none(mocker, au
611611
"status": "INACTIVE",
612612
}
613613
await authorization_client.toggle_access_key_status("", "")
614-
mock.assert_called_with(application_id=None, key_id=None)
614+
mock.assert_called_with(None, None)
615615

616616

617617
@pytest.mark.asyncio
@@ -623,7 +623,7 @@ async def test_get_tags_for_application_empty_string_converts_to_none(mocker, au
623623
mock = mocker.patch.object(ApplicationResourceApi, "get_tags_for_application")
624624
mock.return_value = []
625625
await authorization_client.get_application_tags("")
626-
mock.assert_called_with(id=None)
626+
mock.assert_called_with(None)
627627

628628

629629
@pytest.mark.asyncio
@@ -636,4 +636,4 @@ async def test_delete_tag_for_application_empty_strings_convert_to_none(
636636

637637
mock = mocker.patch.object(ApplicationResourceApi, "delete_tag_for_application")
638638
await authorization_client.delete_application_tags([], "")
639-
mock.assert_called_with(id=None, tag=None)
639+
mock.assert_called_with(None, None)

0 commit comments

Comments
 (0)