-
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.
Source Marketo: process fail during creation of an export job (#13930)
* #9322 source Marketo: process fail during creation of an export job * #9322 source marketo: upd changelog * #9322 source marketo: fix unit test * #9322 source marketo: fix SATs * auto-bump connector version Co-authored-by: Octavia Squidington III <[email protected]>
- Loading branch information
1 parent
de0cf89
commit e8a5c7f
Showing
12 changed files
with
127 additions
and
44 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
30 changes: 14 additions & 16 deletions
30
airbyte-integrations/connectors/source-marketo/integration_tests/expected_records.txt
Large diffs are not rendered by default.
Oops, something went wrong.
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
58 changes: 58 additions & 0 deletions
58
airbyte-integrations/connectors/source-marketo/unit_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,58 @@ | ||
# | ||
# Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
# | ||
|
||
import pendulum | ||
import pytest | ||
from source_marketo.source import Activities, MarketoAuthenticator | ||
|
||
|
||
@pytest.fixture(autouse=True) | ||
def mock_requests(requests_mock): | ||
requests_mock.register_uri( | ||
"GET", "https://602-euo-598.mktorest.com/identity/oauth/token", json={"access_token": "token", "expires_in": 3600} | ||
) | ||
requests_mock.register_uri( | ||
"POST", | ||
"https://602-euo-598.mktorest.com/bulk/v1/activities/export/create.json", | ||
[ | ||
{"json": {"result": [{"exportId": "2c09ce6d", "format": "CSV", "status": "Created", "createdAt": "2022-06-20T08:44:08Z"}]}}, | ||
{"json": {"result": [{"exportId": "cd465f55", "format": "CSV", "status": "Created", "createdAt": "2022-06-20T08:45:08Z"}]}}, | ||
{"json": {"result": [{"exportId": "null", "format": "CSV", "status": "Failed", "createdAt": "2022-06-20T08:46:08Z"}]}}, | ||
{"json": {"result": [{"exportId": "232aafb4", "format": "CSV", "status": "Created", "createdAt": "2022-06-20T08:47:08Z"}]}}, | ||
], | ||
) | ||
|
||
|
||
@pytest.fixture | ||
def config(): | ||
start_date = pendulum.now().subtract(days=100).strftime("%Y-%m-%dT%H:%M:%SZ") | ||
config = { | ||
"client_id": "client-id", | ||
"client_secret": "********", | ||
"domain_url": "https://602-EUO-598.mktorest.com", | ||
"start_date": start_date, | ||
"window_in_days": 30, | ||
} | ||
config["authenticator"] = MarketoAuthenticator(config) | ||
return config | ||
|
||
|
||
@pytest.fixture | ||
def send_email_stream(config): | ||
activity = { | ||
"id": 6, | ||
"name": "send_email", | ||
"description": "Send Marketo Email to a person", | ||
"primaryAttribute": {"name": "Mailing ID", "dataType": "integer"}, | ||
"attributes": [ | ||
{"name": "Campaign Run ID", "dataType": "integer"}, | ||
{"name": "Choice Number", "dataType": "integer"}, | ||
{"name": "Has Predictive", "dataType": "boolean"}, | ||
{"name": "Step ID", "dataType": "integer"}, | ||
{"name": "Test Variant", "dataType": "integer"}, | ||
], | ||
} | ||
stream_name = f"activities_{activity['name']}" | ||
cls = type(stream_name, (Activities,), {"activity": activity}) | ||
return cls(config) |
19 changes: 19 additions & 0 deletions
19
airbyte-integrations/connectors/source-marketo/unit_tests/test_stream_slices.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,19 @@ | ||
# | ||
# Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
# | ||
|
||
import logging | ||
from unittest.mock import ANY | ||
|
||
from airbyte_cdk.models.airbyte_protocol import SyncMode | ||
|
||
|
||
def test_create_export_job(send_email_stream, caplog): | ||
caplog.set_level(logging.WARNING) | ||
slices = list(send_email_stream.stream_slices(sync_mode=SyncMode.incremental)) | ||
assert slices == [ | ||
{"endAt": ANY, "id": "2c09ce6d", "startAt": ANY}, | ||
{"endAt": ANY, "id": "cd465f55", "startAt": ANY}, | ||
{"endAt": ANY, "id": "232aafb4", "startAt": ANY}, | ||
] | ||
assert "Failed to create export job for data slice " in caplog.records[-1].message |
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