Skip to content

Commit

Permalink
🐛 Source Freshdesk: fix test; update CDK (airbytehq#18389)
Browse files Browse the repository at this point in the history
* 🐛 Source Freshdesk: fix test; update CDK

* 🐛 Source FreshDesk: revert docker label; update CDK
  • Loading branch information
artem1205 authored and jhammarstedt committed Oct 31, 2022
1 parent 36be4d3 commit c9ae0e8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
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

0 comments on commit c9ae0e8

Please sign in to comment.