Example #1
0
    def test_parser__missing_name(self):
        with temporary_dir() as path:
            with open(os.path.join(path, "Test.test"), "w") as f:
                f.write("""<?xml version='1.0' encoding='utf-8'?>
<root xmlns="http://soap.sforce.com/2006/04/metadata">
    <test />
</root>""")
            parser = MetadataXmlElementParser("TestMDT",
                                              path,
                                              "test",
                                              delete=False,
                                              item_xpath="./sf:test")
            with self.assertRaises(MissingNameElementError):
                parser()
Example #2
0
    def test_parser(self):
        with temporary_dir() as path:
            with open(os.path.join(path, "Test.test"), "w") as f:
                f.write("""<?xml version='1.0' encoding='utf-8'?>
<root xmlns="http://soap.sforce.com/2006/04/metadata">
    <test>
        <fullName>Test</fullName>
    </test>
</root>""")
            parser = MetadataXmlElementParser("TestMDT",
                                              path,
                                              "test",
                                              delete=False,
                                              item_xpath="./sf:test")
            result = parser()
            self.assertEqual(
                """    <types>
        <members>Test.Test</members>
        <name>TestMDT</name>
    </types>""",
                "\n".join(result),
            )
Example #3
0
 def test_parser__missing_item_xpath(self):
     with self.assertRaises(ParserConfigurationError):
         parser = MetadataXmlElementParser("TestMDT", None, "test", False)
         self.assertIsNotNone(parser)