|
13 | 13 | from ochazuke import db |
14 | 14 |
|
15 | 15 |
|
16 | | -TIMELINE = {'about': 'Hourly NeedsDiagnosis issues count', |
17 | | - 'date_format': 'w3c', |
18 | | - 'timeline': [] |
19 | | - } |
20 | | - |
21 | | -DATA = [{"count": "485", "timestamp": "2018-05-15T01:00:00Z"}, |
22 | | - {"count": "485", "timestamp": "2018-05-16T02:00:00Z"}, |
| 16 | +DATA = [{"count": "485", "timestamp": "2018-05-16T02:00:00Z"}, |
23 | 17 | {"count": "485", "timestamp": "2018-05-17T03:00:00Z"}, |
24 | 18 | {"count": "485", "timestamp": "2018-05-18T04:00:00Z"}, |
25 | 19 | ] |
26 | 20 |
|
27 | | -DATA2 = [{"count": "485", "timestamp": "2018-05-16T02:00:00Z"}, |
28 | | - {"count": "485", "timestamp": "2018-05-17T03:00:00Z"}, |
29 | | - {"count": "485", "timestamp": "2018-05-18T04:00:00Z"}, |
30 | | - ] |
31 | | - |
32 | 21 | WEEKLY_DATA = [{"count": 471, "timestamp": "2019-05-20T00:00:00Z"}, |
33 | 22 | {"count": 392, "timestamp": "2019-05-27T00:00:00Z"}, |
34 | 23 | {"count": 407, "timestamp": "2019-06-03T00:00:00Z"} |
35 | 24 | ] |
36 | 25 |
|
37 | 26 |
|
38 | | -def mocked_json(expected_data): |
39 | | - """Prepare a json response when fed a dictionary.""" |
40 | | - return json.dumps(expected_data) |
41 | | - |
42 | | - |
43 | 27 | def json_data(filename): |
44 | 28 | """Return a tuple with the content and its signature.""" |
45 | 29 | current_root = os.path.realpath(os.curdir) |
@@ -91,7 +75,7 @@ def test_weeklydata(self, mock_get): |
91 | 75 | @patch('ochazuke.api.views.get_timeline_data') |
92 | 76 | def test_needsdiagnosis_valid_param(self, mock_timeline): |
93 | 77 | """Valid parameters on /needsdiagnosis-timeline.""" |
94 | | - mock_timeline.return_value = DATA2 |
| 78 | + mock_timeline.return_value = DATA |
95 | 79 | url = '/data/needsdiagnosis-timeline?from=2018-05-16&to=2018-05-18' |
96 | 80 | rv = self.client.get(url) |
97 | 81 | self.assertIn( |
|
0 commit comments