From d6d210b27809f21d50dfbc86dc0c7fe0f03d39ef Mon Sep 17 00:00:00 2001 From: Marcos Marx Date: Wed, 2 Mar 2022 19:07:02 -0300 Subject: [PATCH] Source Chargebee: run format and correct unit test (#10811) * feat(chargebee) add credit note model * fix(airbyte): update version Dockerfile * fix(airbyte): update version Dockerfile v2 * correct unit test Co-authored-by: Koen Sengers --- .../source_chargebee/source.py | 16 +++++++++++++++- .../source_chargebee/streams.py | 1 + .../source-chargebee/unit_tests/test_source.py | 18 +++++++++++++++--- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/airbyte-integrations/connectors/source-chargebee/source_chargebee/source.py b/airbyte-integrations/connectors/source-chargebee/source_chargebee/source.py index 56fd7eaa42ca..e7120792bb38 100644 --- a/airbyte-integrations/connectors/source-chargebee/source_chargebee/source.py +++ b/airbyte-integrations/connectors/source-chargebee/source_chargebee/source.py @@ -9,7 +9,21 @@ from airbyte_cdk.sources import AbstractSource from airbyte_cdk.sources.streams import Stream -from .streams import Addon, AttachedItem, Coupon, CreditNote, Customer, Event, Invoice, Item, ItemPrice, Order, Plan, Subscription, Transaction +from .streams import ( + Addon, + AttachedItem, + Coupon, + CreditNote, + Customer, + Event, + Invoice, + Item, + ItemPrice, + Order, + Plan, + Subscription, + Transaction, +) class SourceChargebee(AbstractSource): diff --git a/airbyte-integrations/connectors/source-chargebee/source_chargebee/streams.py b/airbyte-integrations/connectors/source-chargebee/source_chargebee/streams.py index a22afe46791f..1921913a89d4 100644 --- a/airbyte-integrations/connectors/source-chargebee/source_chargebee/streams.py +++ b/airbyte-integrations/connectors/source-chargebee/source_chargebee/streams.py @@ -321,6 +321,7 @@ def request_params(self, **kwargs) -> MutableMapping[str, Any]: params["sort_by[asc]"] = "created_at" return params + class CreditNote(IncrementalChargebeeStream): """ API docs: https://apidocs.chargebee.com/docs/api/credit_notes?prod_cat_ver=2#list_credit_notes diff --git a/airbyte-integrations/connectors/source-chargebee/unit_tests/test_source.py b/airbyte-integrations/connectors/source-chargebee/unit_tests/test_source.py index 165763402b00..c57e94826af4 100644 --- a/airbyte-integrations/connectors/source-chargebee/unit_tests/test_source.py +++ b/airbyte-integrations/connectors/source-chargebee/unit_tests/test_source.py @@ -85,9 +85,20 @@ def test_check_error_v2(test_config_v2): def test_source_streams_v1(test_config_v1): source = SourceChargebee() streams = source.streams(test_config_v1) - assert len(streams) == 9 + assert len(streams) == 10 actual_stream_names = {stream.name for stream in streams} - expected_stream_names = {"coupon", "customer", "event", "invoice", "order", "subscription", "addon", "plan", "transaction"} + expected_stream_names = { + "coupon", + "credit_note", + "customer", + "event", + "invoice", + "order", + "subscription", + "addon", + "plan", + "transaction", + } assert expected_stream_names == actual_stream_names @@ -95,10 +106,11 @@ def test_source_streams_v1(test_config_v1): def test_source_streams_v2(test_config_v2): source = SourceChargebee() streams = source.streams(test_config_v2) - assert len(streams) == 10 + assert len(streams) == 11 actual_stream_names = {stream.name for stream in streams} expected_stream_names = { "coupon", + "credit_note", "customer", "event", "invoice",