Skip to content

Commit 6a44b9c

Browse files
committed
fix test_case
1 parent 0fc5fd9 commit 6a44b9c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

listenbrainz/webserver/views/test/test_user.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import json
22
import logging
33
import time
4-
from datetime import datetime
4+
from datetime import datetime, timezone
55
from unittest import mock
66

77
import orjson
@@ -162,21 +162,21 @@ def test_ts_filters(self, timescale):
162162
# max_ts query param -> to_ts timescale param
163163
self.client.post(self.custom_url_for('user.profile', user_name='iliekcomputers'),
164164
query_string={'max_ts': 1520946000})
165-
req_call = mock.call(user, limit=25, to_ts=datetime.utcfromtimestamp(1520946000))
165+
req_call = mock.call(user, limit=25, to_ts=datetime.fromtimestamp(1520946000, timezone.utc))
166166
timescale.assert_has_calls([req_call])
167167
timescale.reset_mock()
168168

169169
# min_ts query param -> from_ts timescale param
170170
self.client.post(self.custom_url_for('user.profile', user_name='iliekcomputers'),
171171
query_string={'min_ts': 1520941000})
172-
req_call = mock.call(user, limit=25, from_ts=datetime.utcfromtimestamp(1520941000))
172+
req_call = mock.call(user, limit=25, from_ts=datetime.fromtimestamp(1520941000, timezone.utc))
173173
timescale.assert_has_calls([req_call])
174174
timescale.reset_mock()
175175

176176
# If max_ts and min_ts set, only max_ts is used
177177
self.client.post(self.custom_url_for('user.profile', user_name='iliekcomputers'),
178178
query_string={'min_ts': 1520941000, 'max_ts': 1520946000})
179-
req_call = mock.call(user, limit=25, to_ts=datetime.utcfromtimestamp(1520946000))
179+
req_call = mock.call(user, limit=25, to_ts=datetime.fromtimestamp(1520946000, timezone.utc))
180180
timescale.assert_has_calls([req_call])
181181

182182
@mock.patch('listenbrainz.webserver.timescale_connection._ts.fetch_listens')

0 commit comments

Comments
 (0)