Total Complexity | 6 |
Total Lines | 34 |
Duplicated Lines | 0 % |
1 | import json |
||
15 | class coalaHTMLTest(unittest.TestCase): |
||
16 | |||
17 | def setUp(self): |
||
18 | self.old_argv = sys.argv |
||
19 | self.result_file = os.path.join(ROOT, 'coalib', |
||
20 | Constants.CONFIGS['results_file']) |
||
21 | |||
22 | def tearDown(self): |
||
23 | sys.argv = self.old_argv |
||
24 | |||
25 | def test_output_file(self): |
||
26 | update_file = "" |
||
27 | noupdate_file = "" |
||
28 | with prepare_file(["#todo this is todo"], None) as (lines, filename): |
||
29 | execute_coala(coala_html.main, |
||
30 | "coala-html", |
||
31 | "-c", os.devnull, |
||
32 | "-b", "LineCountBear", |
||
33 | "-f", re.escape(filename), |
||
34 | "--nolaunch") |
||
35 | with open(self.result_file) as fp: |
||
36 | update_file = json.load(fp) |
||
37 | execute_coala(coala_html.main, |
||
38 | "coala-html", |
||
39 | "-c", os.devnull, |
||
40 | "-b", "LineCountBear", |
||
41 | "-f", re.escape(filename), |
||
42 | "-N", |
||
43 | "--nolaunch") |
||
44 | with open(self.result_file) as fp: |
||
45 | noupdate_file = json.load(fp) |
||
46 | |||
47 | self.assertEqual(update_file['results']['default'][0]['message'], |
||
48 | noupdate_file['results']['default'][0]['message']) |
||
49 |