Skip to content

Commit

Permalink
test: Implement a simple test for copy-screens
Browse files Browse the repository at this point in the history
  • Loading branch information
drscholly committed Nov 16, 2023
1 parent ac282c2 commit 561765e
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/test_copy_screens.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from toolbox.api.datagalaxy_api import DataGalaxyApiAuthentication, Token
from toolbox.api.datagalaxy_api_screens import DataGalaxyApiScreen
from toolbox.commands.copy_screens import copy_screens
import pytest as pytest


def test_copy_screens_when_no_screen(mocker):
"""
Scenario 1. error
:param mocker:
:return: raise Exception
"""
client_space_mock = mocker.patch.object(Token, 'get_client_space_id', autospec=True)
client_space_mock.return_value = 'cid'
api_authenticate_mock = mocker.patch.object(DataGalaxyApiAuthentication, 'authenticate', autospec=True)
api_authenticate_mock.return_value = 'token'
source_screens_list_mock = mocker.patch.object(DataGalaxyApiScreen, 'list_screens', autospec=True)
source_screens_list_mock.return_value = []

# ASSERT / VERIFY
with pytest.raises(Exception, match='Unexpected error: source has no screen'):
copy_screens(
url_source='url_source',
url_target='url_target',
token_source='token_source',
token_target='token_target',
workspace_source_name=None,
workspace_target_name=None
)

0 comments on commit 561765e

Please sign in to comment.