Skip to content

Commit ffb84ce

Browse files
author
ExpDev07
committed
fix test
1 parent 129600f commit ffb84ce

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

tests/test_location.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
2+
from datetime import datetime
23
from unittest import mock
34
from app import location, coordinates, timeline
45

@@ -9,14 +10,13 @@ def __init__(self, latest):
910

1011
return TestTimeline(args[0])
1112

12-
@pytest.mark.parametrize("test_id, country, country_code, province, latitude, longitude, \
13-
confirmed_latest, deaths_latest, recovered_latest",
14-
[(0, "Thailand", "TH", "", 15, 100, 1000, 1111, 22222),
15-
(1, "Deutschland", "DE", "", 15, 100, 1000, 1111, 22222),
16-
(2, "Cruise Ship", "XX", "", 15, 100, 1000, 1111, 22222)])
13+
@pytest.mark.parametrize("test_id, country, country_code, province, latitude, longitude, confirmed_latest, deaths_latest, recovered_latest", [
14+
(0, "Thailand", "TH", "", 15, 100, 1000, 1111, 22222),
15+
(1, "Deutschland", "DE", "", 15, 100, 1000, 1111, 22222),
16+
(2, "Cruise Ship", "XX", "", 15, 100, 1000, 1111, 22222)
17+
])
1718
@mock.patch('app.timeline.Timeline', side_effect=mocked_timeline)
18-
def test_location_class(mocked_timeline, test_id, country, country_code, province, latitude,
19-
longitude, confirmed_latest, deaths_latest, recovered_latest):
19+
def test_location_class(mocked_timeline, test_id, country, country_code, province, latitude, longitude, confirmed_latest, deaths_latest, recovered_latest):
2020

2121
# id, country, province, coordinates, confirmed, deaths, recovered
2222
coords = coordinates.Coordinates(latitude=latitude, longitude=longitude)
@@ -26,8 +26,11 @@ def test_location_class(mocked_timeline, test_id, country, country_code, provinc
2626
deaths = timeline.Timeline(deaths_latest)
2727
recovered = timeline.Timeline(recovered_latest)
2828

29+
# Date now.
30+
now = datetime.utcnow().isoformat() + 'Z'
31+
2932
# Location.
30-
location_obj = location.TimelinedLocation(test_id, country, province, coords, {
33+
location_obj = location.TimelinedLocation(test_id, country, province, coords, now, {
3134
'confirmed': confirmed,
3235
'deaths' : deaths,
3336
'recovered': recovered,
@@ -41,6 +44,7 @@ def test_location_class(mocked_timeline, test_id, country, country_code, provinc
4144
'country': country,
4245
'country_code': country_code,
4346
'province': province,
47+
'last_updated': now,
4448
'coordinates': {
4549
'latitude': latitude,
4650
'longitude': longitude

0 commit comments

Comments
 (0)