Skip to content

Commit 6364805

Browse files
author
Karl Dubost
authored
Merge pull request #129 from webcompat/128/1
Fixes #128 - Clean out dead code from tests
2 parents 361afd8 + 7692853 commit 6364805

2 files changed

Lines changed: 2 additions & 51 deletions

File tree

tests/unit/test_api.py

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,17 @@
1313
from ochazuke import db
1414

1515

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"},
2317
{"count": "485", "timestamp": "2018-05-17T03:00:00Z"},
2418
{"count": "485", "timestamp": "2018-05-18T04:00:00Z"},
2519
]
2620

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-
3221
WEEKLY_DATA = [{"count": 471, "timestamp": "2019-05-20T00:00:00Z"},
3322
{"count": 392, "timestamp": "2019-05-27T00:00:00Z"},
3423
{"count": 407, "timestamp": "2019-06-03T00:00:00Z"}
3524
]
3625

3726

38-
def mocked_json(expected_data):
39-
"""Prepare a json response when fed a dictionary."""
40-
return json.dumps(expected_data)
41-
42-
4327
def json_data(filename):
4428
"""Return a tuple with the content and its signature."""
4529
current_root = os.path.realpath(os.curdir)
@@ -91,7 +75,7 @@ def test_weeklydata(self, mock_get):
9175
@patch('ochazuke.api.views.get_timeline_data')
9276
def test_needsdiagnosis_valid_param(self, mock_timeline):
9377
"""Valid parameters on /needsdiagnosis-timeline."""
94-
mock_timeline.return_value = DATA2
78+
mock_timeline.return_value = DATA
9579
url = '/data/needsdiagnosis-timeline?from=2018-05-16&to=2018-05-18'
9680
rv = self.client.get(url)
9781
self.assertIn(

tests/unit/test_helpers.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
# License, v. 2.0. If a copy of the MPL was not distributed with this
55
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
66
"""Main testing module for Webcompat Metrics Server."""
7-
import json
8-
import os
97
import unittest
108

119
from werkzeug.datastructures import ImmutableMultiDict
@@ -14,43 +12,12 @@
1412
from ochazuke import helpers
1513

1614

17-
TIMELINE = {'about': 'Hourly NeedsDiagnosis issues count',
18-
'date_format': 'w3c',
19-
'timeline': []
20-
}
21-
2215
DATA = [{"count": "485", "timestamp": "2018-05-15T01:00:00Z"},
2316
{"count": "485", "timestamp": "2018-05-16T02:00:00Z"},
2417
{"count": "485", "timestamp": "2018-05-17T03:00:00Z"},
2518
{"count": "485", "timestamp": "2018-05-18T04:00:00Z"},
2619
]
2720

28-
DATA2 = [{"count": "485", "timestamp": "2018-05-16T02:00:00Z"},
29-
{"count": "485", "timestamp": "2018-05-17T03:00:00Z"},
30-
{"count": "485", "timestamp": "2018-05-18T04:00:00Z"},
31-
]
32-
33-
WEEKLY_DATA = {
34-
"2015": [9, 7, 46],
35-
"2016": [11, 19, 28],
36-
"2017": [35, 29, 40]
37-
}
38-
39-
40-
def mocked_json(expected_data):
41-
"""Prepare a json response when fed a dictionary."""
42-
return json.dumps(expected_data)
43-
44-
45-
def json_data(filename):
46-
"""Return a tuple with the content and its signature."""
47-
current_root = os.path.realpath(os.curdir)
48-
fixtures_path = 'tests/fixtures'
49-
path = os.path.join(current_root, fixtures_path, filename)
50-
with open(path, 'r') as f:
51-
json_event = json.dumps(json.load(f))
52-
return json_event
53-
5421

5522
class HelpersTestCase(unittest.TestCase):
5623
"""General Test Cases for helpers."""

0 commit comments

Comments
 (0)