Пример #1
0
    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')
Пример #2
0
    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')
Пример #3
0
    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()))
Пример #4
0
    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()))
Пример #5
0
    def test_text_output(self):
        output = OutputTool('text')
        data = self.get_data()
        OutputLogger.set_build_data('old', data['old'])
        OutputLogger.set_build_data('new', data['new'])
        OutputLogger.set_checker_output('Following files were moved', '\n'.join(data['moved']))

        logfile = os.path.join(self.TESTS_DIR, REBASE_HELPER_RESULTS_LOG)
        output.print_information(logfile)

        with open(logfile) as f:
            assert f.read().strip() == self.get_expected_output()

        os.unlink(logfile)
Пример #6
0
    def test_text_output(self):
        output = OutputTool('text')
        data = self.get_data()
        OutputLogger.set_build_data('old', data['old'])
        OutputLogger.set_build_data('new', data['new'])
        OutputLogger.set_patch_output('Patches:', data['patches'])
        test_output = {'pkgdiff': ['Following files were moved\n%s' % '\n'.join(data['moved'])]}
        OutputLogger.set_checker_output('Results from checker(s)', test_output)

        logfile = os.path.join(self.TESTS_DIR, REBASE_HELPER_RESULTS_LOG)
        output.print_information(logfile)

        with open(logfile) as f:
            lines = [y.strip() for y in f.readlines()]
            assert lines == self.get_expected_output().split('\n')

        os.unlink(logfile)