-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Source Facebook Marketing: support insights streams via async queries (…
- Loading branch information
1 parent
14e7304
commit 8dc6c7c
Showing
20 changed files
with
11,090 additions
and
2,883 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
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
22 changes: 0 additions & 22 deletions
22
airbyte-integrations/connectors/source-facebook-marketing/Dockerfile.test
This file was deleted.
Oops, something went wrong.
15 changes: 14 additions & 1 deletion
15
airbyte-integrations/connectors/source-facebook-marketing/build.gradle
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,13 +1,26 @@ | ||
plugins { | ||
id 'airbyte-python' | ||
id 'airbyte-docker' | ||
id 'airbyte-source-test' | ||
id 'airbyte-standard-source-test-file' | ||
} | ||
|
||
airbytePython { | ||
moduleDirectory 'source_facebook_marketing' | ||
} | ||
|
||
airbyteStandardSourceTestFile { | ||
specPath = "source_facebook_marketing/spec.json" | ||
configPath = "secrets/config.json" | ||
configuredCatalogPath = "sample_files/configured_catalog.json" | ||
} | ||
|
||
task("pythonIntegrationTests", type: PythonTask, dependsOn: installTestReqs) { | ||
module = "pytest" | ||
command = "-s integration_tests" | ||
} | ||
|
||
integrationTest.dependsOn("pythonIntegrationTests") | ||
|
||
dependencies { | ||
implementation files(project(':airbyte-integrations:bases:base-python').airbyteDocker.outputs) | ||
} |
27 changes: 0 additions & 27 deletions
27
airbyte-integrations/connectors/source-facebook-marketing/integration_tests/__init__.py
This file was deleted.
Oops, something went wrong.
58 changes: 58 additions & 0 deletions
58
...e-integrations/connectors/source-facebook-marketing/integration_tests/integration_test.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,58 @@ | ||
""" | ||
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 | ||
|
||
from airbyte_protocol import ConfiguredAirbyteCatalog, Type | ||
from base_python import AirbyteLogger | ||
from source_facebook_marketing.source import SourceFacebookMarketing | ||
|
||
config = json.loads(open("secrets/config.json", "r").read()) | ||
|
||
|
||
class TestFacebookMarketingSource: | ||
def test_ad_insights_streams_outputs_records(self): | ||
catalog = self._read_catalog("sample_files/configured_catalog_adsinsights.json") | ||
self._run_sync_test(config, catalog) | ||
|
||
def test_ad_creatives_stream_outputs_records(self): | ||
catalog = self._read_catalog("sample_files/configured_catalog_adcreatives.json") | ||
self._run_sync_test(config, catalog) | ||
|
||
@staticmethod | ||
def _read_catalog(path): | ||
return ConfiguredAirbyteCatalog.parse_raw(open(path, "r").read()) | ||
|
||
@staticmethod | ||
def _run_sync_test(conf, catalog): | ||
records = [] | ||
state = [] | ||
for message in SourceFacebookMarketing().read(AirbyteLogger(), conf, catalog): | ||
if message.type == Type.RECORD: | ||
records.append(message) | ||
elif message.type == Type.STATE: | ||
state.append(message) | ||
|
||
assert len(records) > 0 | ||
assert len(state) > 0 |
29 changes: 0 additions & 29 deletions
29
...tegrations/connectors/source-facebook-marketing/integration_tests/standard_source_test.py
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.