Skip to content

Commit

Permalink
Fix tests (#891)
Browse files Browse the repository at this point in the history
* Fix tests

* Fix test_sweep_metrics
  • Loading branch information
raymondjacobson committed Oct 7, 2020
1 parent 86afa16 commit 6d69920
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion discovery-provider/src/queries/get_app_names_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
def test_get_app_names(db_mock):
"""Tests that get_app_names returns the app names"""

date = datetime.utcnow()
date = datetime(2020, 10, 4, 10, 35, 0)
before_date = (date + timedelta(hours=-1))

app_names = [{
Expand Down
4 changes: 2 additions & 2 deletions discovery-provider/tests/test_get_app_name_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def populate_mock_db(db, date1, date2):

def test_get_app_name_metrics(app):
"""Tests that the route metrics are queried correctly from db data"""
date = datetime.utcnow()
date = datetime(2020, 10, 4, 10, 35, 0)
before_date = (date + timedelta(hours=-1))
after_date = (date + timedelta(hours=1))

Expand Down Expand Up @@ -97,7 +97,7 @@ def test_get_app_name_metrics(app):

def test_get_app_name_metrics_with_daily_buckets(app):
"""Tests that the app metrics can be queried with daily buckets"""
date = datetime.utcnow()
date = datetime(2020, 10, 4, 10, 35, 0)
before_date = (date + timedelta(hours=-1))
after_date = (date + timedelta(hours=1))

Expand Down
4 changes: 2 additions & 2 deletions discovery-provider/tests/test_get_genre_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_get_genre_metrics(app):
{"genre": "Electronic"}
]

date = datetime.utcnow()
date = datetime(2020, 10, 4, 10, 35, 0)
before_date = (date + timedelta(hours=-1))
populate_mock_db(db, test_tracks, date)

Expand All @@ -67,7 +67,7 @@ def test_get_genre_metrics(app):

def test_get_genre_metrics_for_month(app):
"""Tests that genre metrics can be queried over a large time range"""
date = datetime.utcnow()
date = datetime(2020, 10, 4, 10, 35, 0)
long_before_date = (date + timedelta(days=-12))
before_date = (date + timedelta(days=-1))

Expand Down
2 changes: 1 addition & 1 deletion discovery-provider/tests/test_get_plays_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def populate_mock_db(db, date1, date2):
def test_get_plays_metrics(app):
"""Tests that plays metrics can be queried"""

date = datetime.utcnow().replace(minute=0, second=0, microsecond=0)
date = datetime(2020, 10, 4).replace(minute=0, second=0, microsecond=0)
date1 = (date + timedelta(hours=-1))
date2 = (date + timedelta(days=-2))
before_date = (date + timedelta(days=-3))
Expand Down
10 changes: 5 additions & 5 deletions discovery-provider/tests/test_get_route_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def populate_mock_db_multiple_dates(db, date1, date2):
def test_get_route_metrics_exact(app):
"""Tests that the route metrics can queried by exact path match"""

date = datetime.utcnow().replace(minute=0, second=0, microsecond=0)
date = datetime(2020, 10, 4).replace(minute=0, second=0, microsecond=0)
before_date = (date + timedelta(hours=-1))

with app.app_context():
Expand All @@ -110,7 +110,7 @@ def test_get_route_metrics_exact(app):
def test_get_route_metrics_non_exact(app):
"""Tests that the route metrics can be queried by non-exact path match"""

date = datetime.utcnow().replace(minute=0, second=0, microsecond=0)
date = datetime(2020, 10, 4).replace(minute=0, second=0, microsecond=0)
before_date = (date + timedelta(hours=-1))

with app.app_context():
Expand All @@ -136,7 +136,7 @@ def test_get_route_metrics_non_exact(app):
def test_get_route_metrics_query_string(app):
"""Tests that the route metrics are queried with query_string parameter"""

date = datetime.utcnow().replace(minute=0, second=0, microsecond=0)
date = datetime(2020, 10, 4).replace(minute=0, second=0, microsecond=0)
before_date = (date + timedelta(hours=-1))

with app.app_context():
Expand All @@ -163,7 +163,7 @@ def test_get_route_metrics_query_string(app):
def test_get_route_metrics_no_matches(app):
"""Tests that route metrics returns nothing if no matching query_string"""

date = datetime.utcnow().replace(minute=0, second=0, microsecond=0)
date = datetime(2020, 10, 4).replace(minute=0, second=0, microsecond=0)
before_date = (date + timedelta(hours=-1))

with app.app_context():
Expand All @@ -188,7 +188,7 @@ def test_get_route_metrics_no_matches(app):
def test_get_route_metrics_with_daily_buckets(app):
"""Tests that the route metrics can be queried with daily buckets"""

date = datetime.utcnow().replace(minute=0, second=0, microsecond=0)
date = datetime(2020, 10, 4).replace(minute=0, second=0, microsecond=0)
date1 = (date + timedelta(hours=-1))
date2 = (date + timedelta(days=-2))
before_date = (date + timedelta(days=-3))
Expand Down

0 comments on commit 6d69920

Please sign in to comment.