Esempio n. 1
0
    def test__get_parameter_attributes_return_userdict(self, path_mock):
        """
        Should return UserDict
        """
        from instructionparsers.xmlparser import XmlParser
        from collections import UserDict

        elem = parse("./instructions/instructions_stub.xml"
                     ).documentElement.childNodes[1]

        actual = XmlParser._get_parameter_attributes(
            attributes=elem.attributes)

        self.assertIsInstance(actual, UserDict)
Esempio n. 2
0
    def test__get_parameter_attributes_return_userdict_with_2_entries(
            self, path_mock):
        """
        Should return dict with two entries
        """
        from instructionparsers.xmlparser import XmlParser
        from collections import UserDict

        elem = parse("./instructions/instructions_stub.xml"
                     ).documentElement.childNodes[1]

        actual = XmlParser._get_parameter_attributes(
            attributes=elem.attributes)

        self.assertEqual(len(actual), 2)
Esempio n. 3
0
    def test__get_parameter_attributes_should_return_none_special_attributes(
            self, path_mock):
        """
        Should return dicitionry with "users_with_homedir" key and with "properties" key.
        """
        from instructionparsers.xmlparser import XmlParser
        from collections import UserDict

        elem = parse("./instructions/instructions_stub.xml"
                     ).documentElement.childNodes[1]

        actual = XmlParser._get_parameter_attributes(
            attributes=elem.attributes)

        self.assertIsNotNone(actual.get("properties"))
        self.assertIsNotNone(actual.get("users_with_homedir"))