예제 #1
0
 def root(self):
     root = Element("SONRS")
     status = base.StatusTestCase().root
     root.append(status)
     SubElement(root, "DTSERVER").text = "20051029101003"
     SubElement(root, "USERKEY").text = "DEADBEEF"
     SubElement(root, "TSKEYEXPIRE").text = "20051231"
     SubElement(root, "LANGUAGE").text = "ENG"
     SubElement(root, "DTPROFUP").text = "20050101"
     SubElement(root, "DTACCTUP").text = "20050102"
     fi = FiTestCase().root
     root.append(fi)
     SubElement(root, "SESSCOOKIE").text = "BADA55"
     SubElement(root, "ACCESSKEY").text = "CAFEBABE"
     return root
예제 #2
0
    def invalidSoup(cls):
        # Don't need to test missing TRNUID, since this case is
        # tested by ``requiredElements``
        tag = cls.__name__.replace("TestCase", "").upper()
        root_ = Element(tag)

        # TRNUID/STATUS/CLTCOOKIE out of order
        trnuid = Element("TRNUID")
        trnuid.text = "DEADBEEF"
        status = base.StatusTestCase().root
        cltcookie = Element("CLTCOOKIE")
        cltcookie.text = "B00B135"

        legal = [trnuid, status, cltcookie]
        legal_tags = [el.tag for el in legal]
        for elements in itertools.permutations(legal):
            if [el.tag for el in elements] == legal_tags:
                continue
            root = deepcopy(root_)
            for element in elements:
                root.append(element)
            root.append(cls.wrapped)
            yield root

        #  requiredMutex= ("intrars", "intramodrs", "intracanrs")
        root_ = deepcopy(cls.emptyBase)
        # Missing INTRARS/INTRAMODRS/INTRACANRS
        yield root

        # Multiple INTRARS/INTRAMODRS/INTRACANRS
        for Tests in [
            (IntrarsTestCase, IntramodrsTestCase),
            (IntrarsTestCase, IntracanrsTestCase),
            (IntramodrsTestCase, IntracanrsTestCase),
        ]:
            root = deepcopy(cls.emptyBase)
            for Test in Tests:
                root.append(Test().root)
            yield root

        # Wrapped aggregate in the wrong place (should be right after CLTCOOKIE)

        root_ = deepcopy(cls.emptyBase)
        index = list(root_).index(root_.find("CLTCOOKIE"))
        for n in range(index):
            root = deepcopy(root_)
            root.insert(n, cls.wrapped)
            yield root