-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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: fix
DATA_RETENTION_PERIOD
validation a…
…nd schema data type `failed_delivery_checks` issues (#15012) * Fix date validation and schema issues * Updated PR number * Updated to review * Updated to review * Update airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_utils.py Co-authored-by: Pedro S. Lopez <pedroslopez@me.com> * Update airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_utils.py Co-authored-by: Pedro S. Lopez <pedroslopez@me.com> * Fix to linter * Fix typo * Updated Docker version * auto-bump connector version [ci skip] Co-authored-by: Pedro S. Lopez <pedroslopez@me.com> Co-authored-by: Octavia Squidington III <octavia-squidington-iii@users.noreply.github.com>
- Loading branch information
1 parent
b01c731
commit 5d18fed
Showing
7 changed files
with
70 additions
and
12 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
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
31 changes: 31 additions & 0 deletions
31
airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_utils.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,31 @@ | ||
# | ||
# Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
# | ||
|
||
import pendulum | ||
import pytest | ||
from source_facebook_marketing.utils import DATA_RETENTION_PERIOD, ValidationDateException, validate_date_field | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"date, expected_message, raise_error", | ||
[ | ||
(pendulum.now(), "", False), | ||
( | ||
pendulum.now() - pendulum.duration(months=DATA_RETENTION_PERIOD.months + 1), | ||
f" cannot be beyond {DATA_RETENTION_PERIOD.months} months from the current date.", | ||
True, | ||
), | ||
(pendulum.now() + pendulum.duration(months=1), " cannot be in the future. Please set today's date or later.", True), | ||
], | ||
ids=["valid_date", f"date in the past by {DATA_RETENTION_PERIOD.months} months", "date in future"], | ||
) | ||
def test_validate_date_field(date, expected_message, raise_error): | ||
field_name = "test_field_name" | ||
|
||
if raise_error: | ||
with pytest.raises(ValidationDateException) as error: | ||
assert validate_date_field(field_name, date) | ||
assert str(error.value) == field_name + expected_message | ||
else: | ||
assert validate_date_field(field_name, date) |
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