Skip to content

Commit 8a4477c

Browse files
committed
Add validations for date range configs
1 parent 62d6e4a commit 8a4477c

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

connectors/sources/google_calendar.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,15 @@ def get_default_configuration(cls):
147147
"order": 3,
148148
"type": "int",
149149
"value": 30,
150+
"validations": [{"type": "greater_than", "constraint": -1}],
150151
},
151152
"days_forward": {
152153
"display": "numeric",
153154
"label": "Days forward to fetch events",
154155
"order": 4,
155156
"type": "int",
156157
"value": 30,
158+
"validations": [{"type": "greater_than", "constraint": -1}],
157159
},
158160
}
159161

tests/sources/test_google_calendar.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,16 @@ async def test_get_default_configuration():
8181
assert "days_back" in config
8282
assert config["days_back"]["type"] == "int"
8383
assert config["days_back"]["value"] == 30
84+
assert config["days_back"]["validations"] == [
85+
{"type": "greater_than", "constraint": -1}
86+
]
8487

8588
assert "days_forward" in config
8689
assert config["days_forward"]["type"] == "int"
8790
assert config["days_forward"]["value"] == 30
91+
assert config["days_forward"]["validations"] == [
92+
{"type": "greater_than", "constraint": -1}
93+
]
8894

8995

9096
@pytest.mark.asyncio

0 commit comments

Comments
 (0)