def test_text_output_tool(self): output = OutputTool('text') output.print_information(self.results_file_path, self.results_store) with open(self.results_file_path) as f: lines = [y.strip() for y in f.readlines()] assert lines == self.get_expected_text_output().split('\n')
def test_json_output_tool(self): output = OutputTool('json') output.print_information(self.results_file_path, self.results_store) with open(self.results_file_path) as f: json_dict = json.load(f, encoding='utf-8') # in Python2 strings in json decoded dict are Unicode, which would make the test fail assert json_dict == json.loads( json.dumps(self.get_expected_json_output()))