Skip to content

Commit

Permalink
unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
koconder committed Oct 5, 2022
1 parent 5acb19a commit d6bbb62
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ def check_connection(self, logger, config) -> Tuple[bool, any]:
"""
Testing connection availability for the connector by granting the credentials.
"""
authenticator = self.get_connection_response(self, config)

try:
if not config["client_secret"] or not config["client_id"]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
def test_check_connection(mocker):
source = SourceGenesys()
logger_mock, config_mock = MagicMock(), MagicMock()
SourceGenesys.get_connection_response = MagicMock()
assert source.check_connection(logger_mock, config_mock) == (True, None)


def test_streams(mocker):
source = SourceGenesys()
config_mock = MagicMock()
SourceGenesys.get_connection_response = MagicMock()
streams = source.streams(config_mock)
# TODO: replace this with your streams number
expected_streams_number = 2
expected_streams_number = 16
assert len(streams) == expected_streams_number
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 +19,19 @@ def patch_base_class(mocker):

def test_request_params(patch_base_class):
stream = GenesysStream()
# TODO: replace this with your input parameters
inputs = {"stream_slice": None, "stream_state": None, "next_page_token": None}
# TODO: replace this with your expected request parameters
expected_params = {}
expected_params = {'pageSize': 500}
assert stream.request_params(**inputs) == expected_params


def test_next_page_token(patch_base_class):
stream = GenesysStream()
# TODO: replace this with your input parameters
inputs = {"response": MagicMock()}
# TODO: replace this with your expected next page token
expected_token = None
assert stream.next_page_token(**inputs) == expected_token


def test_parse_response(patch_base_class):
stream = GenesysStream()
# TODO: replace this with your input parameters
inputs = {"response": MagicMock()}
# TODO: replace this with your expected parced object
expected_parsed_object = {}
assert next(stream.parse_response(**inputs)) == expected_parsed_object


def test_request_headers(patch_base_class):
stream = GenesysStream()
# TODO: replace this with your input parameters
inputs = {"stream_slice": None, "stream_state": None, "next_page_token": None}
# TODO: replace this with your expected request headers
expected_headers = {}
assert stream.request_headers(**inputs) == expected_headers
assert len(stream.request_headers(**inputs)) == 0


def test_http_method(patch_base_class):
stream = GenesysStream()
# TODO: replace this with your expected http request method
expected_method = "GET"
assert stream.http_method == expected_method

Expand All @@ -79,5 +55,5 @@ def test_should_retry(patch_base_class, http_status, should_retry):
def test_backoff_time(patch_base_class):
response_mock = MagicMock()
stream = GenesysStream()
expected_backoff_time = None
expected_backoff_time = 1
assert stream.backoff_time(response_mock) == expected_backoff_time

0 comments on commit d6bbb62

Please sign in to comment.