Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source-Greenhouse: Fix unit tests for new CDK version #28969

Merged
merged 22 commits into from
Aug 3, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
review comments
  • Loading branch information
Joe Reuter committed Aug 2, 2023
commit c6e02d6316caa0ee0dd6f110cf9322217d2ce6fc
Original file line number Diff line number Diff line change
Expand Up @@ -571,8 +571,8 @@ def manifest_declarative_source():

def test_list_streams(manifest_declarative_source):
manifest_declarative_source.streams.return_value = [
create_mock_declarative_stream(create_mock_http_stream("a name", "https://a-url-base.com", "a-path")),
create_mock_declarative_stream(create_mock_http_stream("another name", "https://another-url-base.com", "another-path")),
create_mock_declarative_stream(create_mock_retriever("a name", "https://a-url-base.com", "a-path")),
create_mock_declarative_stream(create_mock_retriever("another name", "https://another-url-base.com", "another-path")),
]

result = list_streams(manifest_declarative_source, {})
Expand Down Expand Up @@ -634,7 +634,7 @@ def test_list_streams_integration_test():
}


def create_mock_http_stream(name, url_base, path):
def create_mock_retriever(name, url_base, path):
http_stream = mock.Mock(spec=SimpleRetriever, autospec=True)
http_stream.name = name
http_stream.requester = MagicMock()
Expand Down Expand Up @@ -704,12 +704,12 @@ def _create_response(body, request):
return response


def _create_page(response_body):
def _create_page_response(response_body):
request = _create_request()
return _create_response(response_body, request)


@patch.object(requests.Session, "send", side_effect=(_create_page({"result": [{"id": 0}, {"id": 1}],"_metadata": {"next": "next"}}), _create_page({"result": [{"id": 2}],"_metadata": {"next": "next"}})) * 10)
@patch.object(requests.Session, "send", side_effect=(_create_page_response({"result": [{"id": 0}, {"id": 1}],"_metadata": {"next": "next"}}), _create_page_response({"result": [{"id": 2}],"_metadata": {"next": "next"}})) * 10)
def test_read_source(mock_http_stream):
"""
This test sort of acts as an integration test for the connector builder.
Expand Down Expand Up @@ -750,7 +750,7 @@ def test_read_source(mock_http_stream):
assert isinstance(s.retriever, SimpleRetrieverTestReadDecorator)


@patch.object(requests.Session, "send", side_effect=(_create_page({"result": [{"id": 0}, {"id": 1}],"_metadata": {"next": "next"}}), _create_page({"result": [{"id": 2}],"_metadata": {"next": "next"}})))
@patch.object(requests.Session, "send", side_effect=(_create_page_response({"result": [{"id": 0}, {"id": 1}],"_metadata": {"next": "next"}}), _create_page_response({"result": [{"id": 2}],"_metadata": {"next": "next"}})))
def test_read_source_single_page_single_slice(mock_http_stream):
max_records = 100
max_pages_per_slice = 1
Expand Down