Skip to content

Commit 85d187a

Browse files
committed
Add more tests
1 parent 25b816b commit 85d187a

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

reportportal_client/aio/client.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,9 +494,7 @@ async def get_launch_ui_url(self, launch_uuid_future: Union[str, Task[str]]) ->
494494

495495
launch_type = 'launches' if mode.upper() == 'DEFAULT' else 'userdebug'
496496

497-
path = 'ui/#{project_name}/{launch_type}/all/{launch_id}'.format(
498-
project_name=self.project.lower(), launch_type=launch_type,
499-
launch_id=launch_id)
497+
path = f'ui/#{self.project.lower()}/{launch_type}/all/{launch_id}'
500498
url = uri_join(self.endpoint, path)
501499
logger.debug('get_launch_ui_url - ID: %s', launch_uuid)
502500
return url

tests/aio/test_aio_client.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,3 +736,39 @@ async def test_update_item(aio_client: Client):
736736
assert actual_json is not None
737737
actual_attributes = actual_json.get('attributes')
738738
verify_attributes(attributes, actual_attributes)
739+
740+
741+
@pytest.mark.skipif(sys.version_info < (3, 8),
742+
reason='the test requires AsyncMock which was introduced in Python 3.8')
743+
@pytest.mark.asyncio
744+
async def test_get_item_id_by_uuid(aio_client: Client):
745+
# noinspection PyTypeChecker
746+
session: mock.AsyncMock = await aio_client.session()
747+
mock_basic_get_response(session)
748+
749+
item_id = 'test_item_uuid'
750+
expected_uri = f'/api/v1/project/item/uuid/{item_id}'
751+
752+
result = await aio_client.get_item_id_by_uuid(item_id)
753+
assert result == GET_RESPONSE_ID
754+
session.get.assert_called_once()
755+
call_args = session.get.call_args_list[0]
756+
assert expected_uri == call_args[0][0]
757+
758+
759+
@pytest.mark.skipif(sys.version_info < (3, 8),
760+
reason='the test requires AsyncMock which was introduced in Python 3.8')
761+
@pytest.mark.asyncio
762+
async def test_get_launch_ui_url(aio_client: Client):
763+
# noinspection PyTypeChecker
764+
session: mock.AsyncMock = await aio_client.session()
765+
mock_basic_get_response(session)
766+
767+
launch_id = 'test_launch_uuid'
768+
expected_uri = f'/api/v1/project/launch/uuid/{launch_id}'
769+
770+
result = await aio_client.get_launch_ui_url(launch_id)
771+
assert result == f'http://endpoint/ui/#project/launches/all/{GET_RESPONSE_ID}'
772+
session.get.assert_called_once()
773+
call_args = session.get.call_args_list[0]
774+
assert expected_uri == call_args[0][0]

0 commit comments

Comments
 (0)