-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* fix backoff of batch requests * fix backoff of batch requests * fix tests * fix tests * fix requirements * fix tests * fix tests * sort codes * format * fix setup * fix integration tests * bump version * fix integration tests Co-authored-by: Eugene Kulak <[email protected]>
- Loading branch information
1 parent
2102c49
commit 008e22e
Showing
18 changed files
with
337 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 6 additions & 7 deletions
13
airbyte-integrations/connectors/source-facebook-marketing/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
FROM airbyte/integration-base-python:0.1.1 | ||
FROM python:3.7-slim | ||
|
||
# Bash is installed for more convenient debugging. | ||
RUN apt-get update && apt-get install -y bash && rm -rf /var/lib/apt/lists/* | ||
|
||
ENV CODE_PATH="source_facebook_marketing" | ||
ENV AIRBYTE_IMPL_MODULE="source_facebook_marketing" | ||
ENV AIRBYTE_IMPL_PATH="SourceFacebookMarketing" | ||
|
||
WORKDIR /airbyte/integration_code | ||
COPY $CODE_PATH ./$CODE_PATH | ||
COPY source_facebook_marketing ./source_facebook_marketing | ||
COPY main.py ./ | ||
COPY setup.py ./ | ||
RUN pip install . | ||
|
||
LABEL io.airbyte.version=0.2.5 | ||
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"] | ||
|
||
LABEL io.airbyte.version=0.2.6 | ||
LABEL io.airbyte.name=airbyte/source-facebook-marketing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
49 changes: 49 additions & 0 deletions
49
airbyte-integrations/connectors/source-facebook-marketing/integration_tests/conftest.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# | ||
# MIT License | ||
# | ||
# Copyright (c) 2020 Airbyte | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
# | ||
|
||
|
||
import json | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture(scope="session", name="config") | ||
def config_fixture(): | ||
with open("secrets/config.json", "r") as config_file: | ||
return json.load(config_file) | ||
|
||
|
||
@pytest.fixture(scope="session", name="config_with_wrong_token") | ||
def config_with_wrong_token_fixture(config): | ||
return {**config, "access_token": "WRONG_TOKEN"} | ||
|
||
|
||
@pytest.fixture(scope="session", name="config_with_wrong_account") | ||
def config_with_wrong_account_fixture(config): | ||
return {**config, "account_id": "WRONG_ACCOUNT"} | ||
|
||
|
||
@pytest.fixture(scope="session", name="config_with_include_deleted") | ||
def config_with_include_deleted_fixture(config): | ||
return {**config, "include_deleted": True} |
42 changes: 42 additions & 0 deletions
42
airbyte-integrations/connectors/source-facebook-marketing/integration_tests/test_client.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# | ||
# MIT License | ||
# | ||
# Copyright (c) 2020 Airbyte | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
# | ||
|
||
|
||
import pytest | ||
from airbyte_cdk.models import AirbyteStream | ||
from source_facebook_marketing.client import Client, FacebookAPIException | ||
|
||
|
||
def test__health_check_with_wrong_token(config_with_wrong_token): | ||
client = Client(**config_with_wrong_token) | ||
alive, error = client.health_check() | ||
|
||
assert not alive | ||
assert error == "Error: 190, Invalid OAuth access token." | ||
|
||
|
||
def test__campaigns_with_wrong_token(config_with_wrong_token): | ||
client = Client(**config_with_wrong_token) | ||
with pytest.raises(FacebookAPIException, match="Error: 190, Invalid OAuth access token"): | ||
next(client.read_stream(AirbyteStream(name="campaigns", json_schema={}))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
airbyte-integrations/connectors/source-facebook-marketing/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
# This file is autogenerated -- only edit if you know what you are doing. Use setup.py for declaring dependencies. | ||
-e ../../bases/airbyte-protocol | ||
-e ../../bases/base-python | ||
-e . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,20 +25,28 @@ | |
|
||
from setuptools import find_packages, setup | ||
|
||
MAIN_REQUIREMENTS = [ | ||
"airbyte-cdk~=0.1", | ||
"cached_property~=1.5", | ||
"facebook_business~=10.0", | ||
"pendulum~=1.2", | ||
] | ||
|
||
TEST_REQUIREMENTS = [ | ||
"pytest~=6.1", | ||
"pytest-mock~=3.6", | ||
"requests_mock~=1.8", | ||
] | ||
|
||
setup( | ||
name="source_facebook_marketing", | ||
description="Source implementation for Facebook Marketing.", | ||
author="Airbyte", | ||
author_email="[email protected]", | ||
packages=find_packages(), | ||
install_requires=[ | ||
"airbyte-protocol==0.0.0", | ||
"base-python==0.0.0", | ||
"facebook_business==10.0.0", | ||
"backoff==1.10.0", | ||
"pendulum==1.2.0", | ||
"cached_property==1.5.2", | ||
"pytest==6.1.2", | ||
], | ||
install_requires=MAIN_REQUIREMENTS, | ||
package_data={"": ["*.json", "schemas/*.json", "schemas/shared/*.json"]}, | ||
extras_require={ | ||
"tests": TEST_REQUIREMENTS, | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.