예제 #1
0
    def makeRecord(self,
                   typeValue=u"user",
                   elementName=u"password",
                   elementValue=u"123"):
        uid = u"id"

        xmlData = dedent(b"""
            <?xml version="1.0" encoding="utf-8"?>

            <directory realm="Test Realm">
              <record type="{type}">
                <uid>{uid}</uid>
                <short-name>{uid}</short-name>
                <{element}>{value}</{element}>
              </record>
            </directory>
            """[1:].format(
            type=typeValue.encode("utf-8"),
            uid=uid.encode("utf-8"),
            element=elementName.encode("utf-8"),
            value=elementValue.encode("utf-8"),
        ))

        # print("-" * 80)
        # print(xmlData)
        # print("-" * 80)

        service = xmlService(self.mktemp(),
                             xmlData=xmlData,
                             serviceClass=DirectoryService)

        # print("Unknown record types:", service.unknownRecordTypes)
        # print("Unknown fields:", service.unknownFieldElements)

        return service.recordWithUID(uid)
예제 #2
0
    def makeRecord(
        self, typeValue=u"user", elementName=u"password", elementValue=u"123"
    ):
        uid = u"id"

        xmlData = dedent(
            b"""
            <?xml version="1.0" encoding="utf-8"?>

            <directory realm="Test Realm">
              <record type="{type}">
                <uid>{uid}</uid>
                <short-name>{uid}</short-name>
                <{element}>{value}</{element}>
              </record>
            </directory>
            """[1:]
            .format(
                type=typeValue.encode("utf-8"),
                uid=uid.encode("utf-8"),
                element=elementName.encode("utf-8"),
                value=elementValue.encode("utf-8"),
            )
        )

        # print("-" * 80)
        # print(xmlData)
        # print("-" * 80)

        service = xmlService(
            self.mktemp(), xmlData=xmlData, serviceClass=DirectoryService
        )

        # print("Unknown record types:", service.unknownRecordTypes)
        # print("Unknown fields:", service.unknownFieldElements)

        return service.recordWithUID(uid)
예제 #3
0
 def service(self, subClass=None, xmlData=None):
     return xmlService(self.mktemp())
예제 #4
0
 def service(self, subClass=None, xmlData=None):
     return xmlService(self.mktemp())
 def xmlService(self, xmlData=None, serviceClass=None):
     return xmlService(self.mktemp(), xmlData, serviceClass)