def test_report_error(): test.report(['error.png'],process_image) result=read_file('log/report/report.csv') assert result.startswith('Test Image,Result,Message\n'+ 'tests/data/orange.png,PASS,\n'+ 'tests/data/orange.png,FAIL,log/report/images/') assert result.endswith('error.png,ERROR,'+ROOT_DIR+'/tests/test_reporter.py:31;\n')
def test_report_error(): test.report(['error.png'], process_image) values = read_csv(report_path) assert len(values) == 4 assert values[-1][0] == 'error.png' assert values[-1][1] == 'ERROR' assert values[-1][2] == ROOT_DIR + '/tests/test_reporter.py:40;'
def test_report_fail(show_image): show_image.return_value = ord("n") test.report(['tests/data/orange.png'], process_image) values = read_csv(report_path) assert len(values) == 3 assert values[-1][0] == 'tests/data/orange.png' assert values[-1][1] == 'FAIL' assert os.path.exists(values[-1][2]) is True
def test_report_pass(show_image): remove_dirs('log/report/') show_image.return_value = ord("y") test.report(['tests/data/orange.png'], process_image) values = read_csv(report_path) assert len(values) == 2 assert values[0] == ['Test Image', 'Result', 'Message'] assert values[1] == ['tests/data/orange.png', 'PASS', '']
def test_report_pass(show_image): remove_dirs('log/report/') show_image.return_value=ord("y") test.report(['tests/data/orange.png'],process_image) assert read_file('log/report/report.csv') == 'Test Image,Result,Message\ntests/data/orange.png,PASS,\n'
def test_report_fail(show_image): show_image.return_value=ord("n") test.report(['tests/data/orange.png'],process_image) assert read_file('log/report/report.csv').startswith('Test Image,Result,Message\n'+ 'tests/data/orange.png,PASS,\n'+ 'tests/data/orange.png,FAIL,log/report/images/')