コード例 #1
0
ファイル: test_utils.py プロジェクト: lian-heng/dump2polarion
 def test_write_xml_root_file(self, tmpdir):
     fname = "complete_transform_noresponse.xml"
     xml_root = utils.get_xml_root(os.path.join(conf.DATA_PATH, fname))
     dirname = str(tmpdir)
     utils.write_xml_root(xml_root,
                          filename=os.path.join(dirname, "output123.xml"))
     assert "output123.xml" in os.listdir(dirname)[0]
コード例 #2
0
 def test_fill_testcase_response(self, fname):
     xml_root = utils.get_xml_root(os.path.join(conf.DATA_PATH, fname))
     name, value = properties.fill_response_property(xml_root)
     filled = utils.etree_to_string(xml_root)
     assert name == "dump2polarion"
     assert value
     assert '<response-property name="dump2polarion" value=' in filled
コード例 #3
0
 def test_fill_testrun_present(self):
     fname = "complete_notransform.xml"
     fname = os.path.join(conf.DATA_PATH, fname)
     xml_root = utils.get_xml_root(fname)
     properties.xunit_fill_testrun_id(xml_root, "not_used")
     filled = utils.etree_to_string(xml_root)
     assert 'name="polarion-testrun-id" value="5_8_0_17"' in filled
コード例 #4
0
 def test_remove_testsuites_response_property(self):
     fname = "complete_transform.xml"
     xml_root = utils.get_xml_root(os.path.join(conf.DATA_PATH, fname))
     filled = utils.etree_to_string(xml_root)
     assert '<property name="polarion-response-test"' in filled
     properties.remove_response_property(xml_root)
     filled = utils.etree_to_string(xml_root)
     assert '<property name="polarion-response-test"' not in filled
コード例 #5
0
 def test_fill_testsuites_response(self):
     fname = "complete_transform_noresponse.xml"
     xml_root = utils.get_xml_root(os.path.join(conf.DATA_PATH, fname))
     name, value = properties.fill_response_property(xml_root)
     filled = utils.etree_to_string(xml_root)
     assert name == "dump2polarion"
     assert value
     assert '<property name="polarion-response-dump2polarion" value=' in filled
コード例 #6
0
 def test_add_testcases_dry_run(self):
     fname = "testcases_noprop.xml"
     xml_root = utils.get_xml_root(os.path.join(conf.DATA_PATH, fname))
     filled = utils.etree_to_string(xml_root)
     assert "dry-run" not in filled
     properties.set_dry_run(xml_root, True)
     filled = utils.etree_to_string(xml_root)
     assert 'property name="dry-run" value="true"' in filled
コード例 #7
0
 def test_add_testcases_lookup_property(self):
     fname = "testcases_noprop.xml"
     xml_root = utils.get_xml_root(os.path.join(conf.DATA_PATH, fname))
     filled = utils.etree_to_string(xml_root)
     assert "lookup-method" not in filled
     properties.set_lookup_method(xml_root, "name")
     filled = utils.etree_to_string(xml_root)
     assert 'property name="lookup-method" value="name"' in filled
コード例 #8
0
 def test_remove_testcases_property(self):
     fname = "testcases.xml"
     xml_root = utils.get_xml_root(os.path.join(conf.DATA_PATH, fname))
     filled = utils.etree_to_string(xml_root)
     assert '<property name="lookup-method"' in filled
     properties.remove_property(xml_root, "lookup-method")
     filled = utils.etree_to_string(xml_root)
     assert '<property name="lookup-method"' not in filled
コード例 #9
0
 def test_remove_testcases_response_property(self):
     fname = "testcases.xml"
     xml_root = utils.get_xml_root(os.path.join(conf.DATA_PATH, fname))
     filled = utils.etree_to_string(xml_root)
     assert '<response-property name="test"' in filled
     properties.remove_response_property(xml_root)
     filled = utils.etree_to_string(xml_root)
     assert "<response-properties" not in filled
コード例 #10
0
ファイル: test_utils.py プロジェクト: mshriver/dump2polarion
 def test_fill_custom_testsuites_response(self):
     fname = 'complete_transform_noresponse.xml'
     xml_root = utils.get_xml_root(os.path.join(conf.DATA_PATH, fname))
     name, value = utils.fill_response_property(xml_root, 'test', 'test')
     filled = utils.etree_to_string(xml_root)
     assert name == 'test'
     assert value == 'test'
     assert '<property name="polarion-response-test" value="test"' in filled
コード例 #11
0
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")
コード例 #12
0
ファイル: test_utils.py プロジェクト: mshriver/dump2polarion
 def test_fill_custom_testcase_response(self):
     fname = 'testcases_noresponse.xml'
     xml_root = utils.get_xml_root(os.path.join(conf.DATA_PATH, fname))
     name, value = utils.fill_response_property(xml_root, 'test', 'test')
     filled = utils.etree_to_string(xml_root)
     assert name == 'test'
     assert value == 'test'
     assert '<response-property name="test" value="test"' in filled
     # make sure response properties are on top
     assert '<testcases project-id="RHCF3">\n  <response-properties>' in filled
コード例 #13
0
 def test_nofill_response(self, fname):
     xml_root = utils.get_xml_root(os.path.join(conf.DATA_PATH, fname))
     name, value = properties.fill_response_property(xml_root)
     assert name == "test"
     assert value == "test"
コード例 #14
0
 def test_fill_testrun_missing(self):
     fname = "properties.xml"
     xml_root = utils.get_xml_root(os.path.join(conf.DATA_PATH, fname))
     properties.xunit_fill_testrun_id(xml_root, "5_8_0_17")
     filled = utils.etree_to_string(xml_root)
     assert 'name="polarion-testrun-id" value="5_8_0_17"' in filled
コード例 #15
0
ファイル: test_utils.py プロジェクト: lian-heng/dump2polarion
 def test_invalid_xml_root(self):
     with pytest.raises(Dump2PolarionException) as excinfo:
         utils.get_xml_root("NONEXISTENT.xml")
     assert "Failed to parse XML file" in str(excinfo.value)