def test_get_requirements_taget(self, config_prop): xml_root = utils.get_xml_root_from_str("<requirements/>") submit_config = submit.SubmitConfig(xml_root, config_prop, user="******", password="******") assert "requirement" in submit_config.submit_target
def test_get_testsuites_taget(self, config_prop): xml_root = utils.get_xml_root_from_str("<testsuites/>") submit_config = submit.SubmitConfig(xml_root, config_prop, user="******", password="******") assert "xunit" in submit_config.submit_target
def _get_xml_root(xml_root, xml_str, xml_file): if xml_root is not None: return xml_root if xml_str: return utils.get_xml_root_from_str(xml_str) if xml_file: return utils.get_xml_root(xml_file) raise Dump2PolarionException("Failed to submit to Polarion - no data supplied")
def test_get_testsuites_taget(self, config_prop): xml_root = utils.get_xml_root_from_str('<testsuites/>') response = submit._get_submit_target(xml_root, config_prop) assert 'xunit' in response
def test_fill_invalid_testsuites_response(self): xml_root = utils.get_xml_root_from_str("<invalid/>") with pytest.raises(Dump2PolarionException) as excinfo: properties.fill_response_property(xml_root, "test", "test") assert "XML file is not in expected format" in str(excinfo.value)
def test_fill_testrun_no_properties(self): xml_root = utils.get_xml_root_from_str("<testsuites/>") with pytest.raises(Dump2PolarionException) as excinfo: properties.xunit_fill_testrun_id(xml_root, "5_8_0_17") assert "Failed to find <properties> in the XML file" in str( excinfo.value)
def test_fill_testrun_invalid_xml(self): xml_root = utils.get_xml_root_from_str("<invalid/>") with pytest.raises(Dump2PolarionException) as excinfo: properties.xunit_fill_testrun_id(xml_root, "5_8_0_17") assert "missing <testsuites>" in str(excinfo.value)
def test_invalid_xml_str(self): with pytest.raises(Dump2PolarionException) as excinfo: utils.get_xml_root_from_str(None) assert "Failed to parse XML string" in str(excinfo.value)
def test_fill_testrun_invalid_xml(self): xml_root = utils.get_xml_root_from_str('<invalid/>') with pytest.raises(Dump2PolarionException) as excinfo: utils.xunit_fill_testrun_id(xml_root, '5_8_0_17') assert 'missing <testsuites>' in str(excinfo.value)
def test_fill_invalid_testsuites_response(self): xml_root = utils.get_xml_root_from_str('<invalid/>') with pytest.raises(Dump2PolarionException) as excinfo: utils.fill_response_property(xml_root, 'test', 'test') assert 'XML file is not in expected format' in str(excinfo.value)