Skip to content

Commit

Permalink
Merge pull request #46 from cowprotocol/change_parameter_naming
Browse files Browse the repository at this point in the history
Change naming of start and end time
  • Loading branch information
fhenneke authored Sep 20, 2024
2 parents 0a4669b + b638d98 commit c7f25ef
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
black==22.8.0
pylint==2.15.0
pytest==7.1.3
mypy==0.971
mypy
4 changes: 2 additions & 2 deletions src/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ def for_day(cls, day: date) -> TimeWindow:
def as_query_parameters(self) -> list[QueryParameter]:
"""Dune query parameters defined by the start and end of the window"""
return [
QueryParameter.date_type(name="StartTime", value=self.start),
QueryParameter.date_type(name="EndTime", value=self.end),
QueryParameter.date_type(name="start_time", value=self.start),
QueryParameter.date_type(name="end_time", value=self.end),
]

def next(self) -> TimeWindow:
Expand Down
9 changes: 6 additions & 3 deletions tests/e2e/test_query_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def test_query_runner(self, mocked_post):
query = load_config(filepath("v2-test-data.yaml")).query
dune = DuneClient(os.environ["DUNE_API_KEY"])
slack_client = BasicSlackClient(token="Fake Token", channel="Fake Channel")
query_runner = QueryRunner(query, dune, slack_client)
ping_frequency = 10
query_runner = QueryRunner(query, dune, slack_client, ping_frequency)
query_runner.run_loop()
mocked_post.assert_called_with(
f"{query.name} - detected 1 cases. Results available at {query.result_url()}"
Expand All @@ -30,7 +31,8 @@ def test_v3_query(self, mocked_post):
query = load_config(filepath("v3-left-bounded.yaml")).query
dune = DuneClient(os.environ["DUNE_API_KEY"])
slack_client = BasicSlackClient(token="Fake Token", channel="Fake Channel")
query_runner = QueryRunner(query, dune, slack_client)
ping_frequency = 10
query_runner = QueryRunner(query, dune, slack_client, ping_frequency)
query_runner.run_loop()
mocked_post.assert_called_with(
f"{query.name} - detected 1 cases. Results available at {query.result_url()}"
Expand All @@ -42,7 +44,8 @@ def test_v3_last_hour(self, mocked_post):
query = load_config(filepath("v3-last-hour.yaml")).query
dune = DuneClient(os.environ["DUNE_API_KEY"])
slack_client = BasicSlackClient(token="Fake Token", channel="Fake Channel")
query_runner = QueryRunner(query, dune, slack_client)
ping_frequency = 10
query_runner = QueryRunner(query, dune, slack_client, ping_frequency)
query_runner.run_loop()
mocked_post.assert_called_with(
f"{query.name} - detected 1 cases. Results available at {query.result_url()}"
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ def test_as_query_params(self):
self.assertEqual(
window.as_query_parameters(),
[
QueryParameter.date_type(name="StartTime", value=self.start),
QueryParameter.date_type(name="start_time", value=self.start),
QueryParameter.date_type(
name="EndTime", value=self.start + timedelta(hours=window.length)
name="end_time", value=self.start + timedelta(hours=window.length)
),
],
)
Expand Down

0 comments on commit c7f25ef

Please sign in to comment.