def test__add_result__junit_provider_zero_test_result__provider_has_data(): report_writer_man = ReportWriterManager(ReportWriters.JUNIT) test_results = TestResults() report_writer_man.add_result('notepad', test_results) report_man = report_writer_man._providers[ReportWritersTypes.JUNIT] assert report_man.has_data()
def test__add_result__tags_provider_one_test_result__provider_has_data(): report_writer_man = ReportWriterManager(ReportWriters.TAGS) test_results = TestResults() test_results.append(TestResult("mycase", True, 10, ['hello'])) report_writer_man.add_result('notepad', test_results) report_man = report_writer_man._providers[ReportWritersTypes.TAGS] assert report_man.has_data()
def test__add_result__junit_provider_one_test_result__provider_has_data(): report_writer_man = ReportWriterManager(ReportWriters.JUNIT) test_results = TestResults() test_results.append(TestResult("mycase", True, 10, [])) report_writer_man.add_result('notepad', test_results) report_man = report_writer_man._providers[ReportWritersTypes.JUNIT] assert isinstance(report_man, JunitXMLReportWriter) assert report_man.has_data()
def test__write__two_providers__returns_two_names(): report_writer_man = ReportWriterManager(ReportWriters.TAGS + ReportWriters.JUNIT) test_results = TestResults() test_results.append(TestResult("mycase", True, 10, ['hello'])) report_writer_man.add_result('notepad', test_results) results = report_writer_man.providers_names() assert len(results) == 2
def test__reportwritermanager_ctor__tags_and_junit_report__valid_manager(): report_writer_man = ReportWriterManager(ReportWriters.TAGS + ReportWriters.JUNIT) assert len(report_writer_man._providers) == 2 report_man = report_writer_man._providers[ReportWritersTypes.TAGS] assert isinstance(report_man, TagsReportWriter) report_man = report_writer_man._providers[ReportWritersTypes.JUNIT] assert isinstance(report_man, JunitXMLReportWriter)
def test__run_one_test_junit_writter__writer_writes(mocker): test_results = TestResults().serialize() cli = _get_cli_for_tests(mocker, 'SUCCESS', 'TERMINATED', test_results) mocker.patch.object(cli, '_get_report_writer_manager') mock_report_manager = ReportWriterManager(ReportWriters.JUNIT) mocker.patch.object(mock_report_manager, 'write') mocker.patch.object(mock_report_manager, 'add_result') cli._get_report_writer_manager.return_value = mock_report_manager cli.run('test_mynotebook2', 'cluster') assert mock_report_manager.add_result.call_count == 1 assert mock_report_manager.write.call_count == 1 assert not mock_report_manager._providers[ ReportWritersTypes.JUNIT].has_data()
def test__reportwritermanager_ctor__invalid_report__empty_manager(): report_writer_man = ReportWriterManager(0) assert len(report_writer_man._providers) == 0
def test__reportwritermanager_ctor__tags_report__valid_manager(): report_writer_man = ReportWriterManager(ReportWriters.TAGS) assert len(report_writer_man._providers) == 1 report_man = report_writer_man._providers[ReportWritersTypes.TAGS] assert isinstance(report_man, TagsReportWriter)