def report_resource(mock_plugin_class, mock_plugin_list, config): mock_plugin_list.return_value = ['polarion'] mock_plugin_class.return_value = ImporterPlugin params = dict(description='description', executes='execute', provider=dict(name='polarion', credential='polarion' ), do_import=False) report = Report(name='text.xml', parameters=params, config=config) # setting this to false since no actual importer is present report.do_import = False return report
def report1(mock_plugin_class, mock_plugin_list, default_report_params, config): mock_plugin_list.return_value = ['polarion'] mock_plugin_class.return_value = ImporterPlugin return Report(name='SampleTest.xml', parameters=default_report_params, config=config)
def test_timeout_from_scenario(mock_plugin_class, mock_plugin_list, timeout_param_report, config): mock_plugin_list.return_value = ['polarion'] mock_plugin_class.return_value = ImporterPlugin params = copy.deepcopy(timeout_param_report) report = Report(name='report', parameters=params, config=config) assert report._report_timeout is 20
def test_create_report_with_executes_as_str_1(mock_plugin_class, mock_plugin_list, default_report_params, config): default_report_params['executes'] = 'execute 01,execute 02, execute03' mock_plugin_list.return_value = ['polarion'] mock_plugin_class.return_value = ImporterPlugin report = Report(name='test.xml', parameters=default_report_params, config=config) assert isinstance(report.executes, list) assert len(report.executes) == 3
def test_create_report_without_executes(mock_plugin_class, mock_plugin_list, default_report_params, config): params = copy.deepcopy(default_report_params) del params['executes'] mock_plugin_list.return_value = ['polarion'] mock_plugin_class.return_value = ImporterPlugin report = Report(name='test.xml', parameters=params, config=config) assert isinstance(report.executes, list)
def test_timeout_from_cfg(mock_plugin_class, mock_plugin_list, config, report_params_np): mock_plugin_list.return_value = ['polarion'] mock_plugin_class.return_value = ImporterPlugin report = Report(name='test.xml', parameters=report_params_np, config=config) assert report._report_timeout is 25
def test_create_report_without_provider_key(mock_plugin_class, mock_plugin_list, report_params_np, config): """The test is to verify that when report params are passed correctly without the provider dictionary""" mock_plugin_list.return_value = ['polarion'] mock_plugin_class.return_value = ImporterPlugin report = Report(name='test.xml', parameters=report_params_np, config=config) assert report.credential['name'] == 'polarion'
def test_create_report_without_executes(default_report_params, config): params = copy.deepcopy(default_report_params) del params['executes'] report = Report(name='test.xml', parameters=params, config=config) assert isinstance(report.executes, list)
def test_create_report_without_name(): with pytest.raises(TefloReportError) as ex: Report() assert 'Unable to build report object. Name field missing!' in \ ex.value.args