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 Freshdesk: fix test; update CDK #18389

Merged
merged 2 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-freshdesk/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from setuptools import find_packages, setup

MAIN_REQUIREMENTS = [
"airbyte-cdk~=0.1",
"airbyte-cdk~=0.2",
"backoff==1.10.0",
"requests==2.25.1",
"pendulum==2.1.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import random
from typing import Any, MutableMapping
from unittest.mock import patch, PropertyMock

import pytest
from airbyte_cdk.models import SyncMode
Expand Down Expand Up @@ -125,18 +126,19 @@ def test_incremental(stream, resource, authenticator, config, requests_mock):
highest_updated_at = "2022-04-25T22:00:00Z"
other_updated_at = "2022-04-01T00:00:00Z"
highest_index = random.randint(0, 24)
requests_mock.register_uri(
"GET",
f"/api/{resource}",
json=[{"id": x, "updated_at": highest_updated_at if x == highest_index else other_updated_at} for x in range(25)],
)

stream = stream(authenticator=authenticator, config=config)
records, state = _read_incremental(stream, {})

assert len(records) == 25
assert "updated_at" in state
assert state["updated_at"] == highest_updated_at
with patch(f'source_freshdesk.streams.{stream.__name__}.use_cache', new_callable=PropertyMock, return_value=False):
requests_mock.register_uri(
"GET",
f"/api/{resource}",
json=[{"id": x, "updated_at": highest_updated_at if x == highest_index else other_updated_at} for x in range(25)],
)

stream = stream(authenticator=authenticator, config=config)
records, state = _read_incremental(stream, {})

assert len(records) == 25
assert "updated_at" in state
assert state["updated_at"] == highest_updated_at


@pytest.mark.parametrize(
Expand Down