Skip to content

Commit

Permalink
Source-Greenhouse: Fix unit tests for new CDK version (#28969)
Browse files Browse the repository at this point in the history
Fix unit tests
  • Loading branch information
Joe Reuter authored and jbfbell committed Aug 5, 2023
1 parent ef95c9b commit e76059f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ COPY main.py ./
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.4.1
LABEL io.airbyte.version=0.4.2
LABEL io.airbyte.name=airbyte/source-greenhouse
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: 59f1e50a-331f-4f09-b3e8-2e8d4d355f44
dockerImageTag: 0.4.1
dockerImageTag: 0.4.2
dockerRepository: airbyte/source-greenhouse
githubIssueLabel: source-greenhouse
icon: greenhouse.svg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,28 @@ def create_response(headers):
def test_next_page_token_has_next(applications_stream):
headers = {"link": '<https://harvest.greenhouse.io/v1/applications?per_page=100&since_id=123456789>; rel="next"'}
response = create_response(headers)
next_page_token = applications_stream.retriever.next_page_token(response=response)
next_page_token = applications_stream.retriever._next_page_token(response=response)
assert next_page_token == {"next_page_token": "https://harvest.greenhouse.io/v1/applications?per_page=100&since_id=123456789"}


def test_next_page_token_has_not_next(applications_stream):
response = create_response({})
next_page_token = applications_stream.retriever.next_page_token(response=response)
next_page_token = applications_stream.retriever._next_page_token(response=response)

assert next_page_token is None


def test_request_params_next_page_token_is_not_none(applications_stream):
response = create_response({"link": f'<https://harvest.greenhouse.io/v1/applications?per_page={100}&since_id=123456789>; rel="next"'})
next_page_token = applications_stream.retriever.next_page_token(response=response)
request_params = applications_stream.retriever.request_params(next_page_token=next_page_token, stream_state={})
path = applications_stream.retriever.path(next_page_token=next_page_token, stream_state={})
next_page_token = applications_stream.retriever._next_page_token(response=response)
request_params = applications_stream.retriever._request_params(next_page_token=next_page_token, stream_state={})
path = applications_stream.retriever._paginator_path()
assert "applications?per_page=100&since_id=123456789" == path
assert request_params == {"per_page": 100}


def test_request_params_next_page_token_is_none(applications_stream):
request_params = applications_stream.retriever.request_params(stream_state={})
request_params = applications_stream.retriever._request_params(stream_state={})

assert request_params == {"per_page": 100}

Expand Down Expand Up @@ -138,7 +138,7 @@ def test_parse_response_expected_response(applications_stream):
]
"""
response._content = response_content
parsed_response = applications_stream.retriever.parse_response(response, stream_state={})
parsed_response = applications_stream.retriever._parse_response(response, stream_state={})
records = [dict(record) for record in parsed_response]

assert records == json.loads(response_content)
Expand All @@ -148,7 +148,7 @@ def test_parse_response_empty_content(applications_stream):
response = requests.Response()
response.status_code = 200
response._content = b"[]"
parsed_response = applications_stream.retriever.parse_response(response, stream_state={})
parsed_response = applications_stream.retriever._parse_response(response, stream_state={})
records = [record for record in parsed_response]

assert records == []
Expand All @@ -164,7 +164,7 @@ def test_ignore_403(applications_stream):
response = requests.Response()
response.status_code = 403
response._content = b""
parsed_response = applications_stream.retriever.parse_response(response, stream_state={})
parsed_response = applications_stream.retriever._parse_response(response, stream_state={})
records = [record for record in parsed_response]
assert records == []

Expand All @@ -173,5 +173,5 @@ def test_retry_429(applications_stream):
response = requests.Response()
response.status_code = 429
response._content = b"{}"
should_retry = applications_stream.retriever.should_retry(response)
should_retry = applications_stream.retriever.requester._should_retry(response)
assert should_retry is True
1 change: 1 addition & 0 deletions docs/integrations/sources/greenhouse.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ The Greenhouse connector should not run into Greenhouse API limitations under no

| Version | Date | Pull Request | Subject |
|:--------|:-----------|:---------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 0.4.2 | 2023-08-02 | [28969](https://github.com/airbytehq/airbyte/pull/28969) | Update CDK version |
| 0.4.1 | 2023-06-28 | [27773](https://github.com/airbytehq/airbyte/pull/27773) | Update following state breaking changes |
| 0.4.0 | 2023-04-26 | [25332](https://github.com/airbytehq/airbyte/pull/25332) | Add new streams: `ActivityFeed`, `Approvals`, `Disciplines`, `Eeoc`, `EmailTemplates`, `Offices`, `ProspectPools`, `Schools`, `Tags`, `UserPermissions`, `UserRoles` |
| 0.3.1 | 2023-03-06 | [23231](https://github.com/airbytehq/airbyte/pull/23231) | Publish using low-code CDK Beta version |
Expand Down

0 comments on commit e76059f

Please sign in to comment.