@@ -43,82 +43,10 @@ def test_add_name_type(self):
4343 self .assertTrue ("Remote Access Trojan" in maec_xml )
4444
4545
46- # This test no longer reflects the proper usage of the MAECInstance object
47- # class PythonMAECEtreeTests(unittest.TestCase):
48- # XML = (
49- # """
50- # <stix-maec:MAEC
51- # xmlns:cyboxCommon="http://cybox.mitre.org/common-2"
52- # xmlns:cybox="http://cybox.mitre.org/cybox-2"
53- # xmlns:cyboxVocabs="http://cybox.mitre.org/default_vocabularies-2"
54- # xmlns:FileObj="http://cybox.mitre.org/objects#FileObject-2"
55- # xmlns:example="http://example.com"
56- # xmlns:maecPackage="http://maec.mitre.org/XMLSchema/maec-package-2"
57- # xmlns:maecVocabs="http://maec.mitre.org/default_vocabularies-1"
58- # xmlns:ttp="http://stix.mitre.org/TTP-1"
59- # xmlns:stixCommon="http://stix.mitre.org/common-1"
60- # xmlns:stixVocabs="http://stix.mitre.org/default_vocabularies-1"
61- # xmlns:stix-maec="http://stix.mitre.org/extensions/Malware#MAEC4.1-1"
62- # xmlns:stix="http://stix.mitre.org/stix-1"
63- # xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
64- # xsi:type='stix-maec:MAEC4.1InstanceType'
65- # id="example:package-2fb96bef-1b11-436e-af4a-15588ac3198b" schema_version="2.1">
66- # <maecPackage:Malware_Subjects>
67- # <maecPackage:Malware_Subject>
68- # <maecPackage:Malware_Instance_Object_Attributes id="maec-tst-obj-1">
69- # <cybox:Properties xsi:type="FileObj:FileObjectType">
70- # <FileObj:Hashes>
71- # <cyboxCommon:Hash>
72- # <cyboxCommon:Type xsi:type="cyboxVocabs:HashNameVocab-1.0">MD5</cyboxCommon:Type>
73- # <cyboxCommon:Simple_Hash_Value>9d7006e30fdf15e9c8e03e62534b3a3e</cyboxCommon:Simple_Hash_Value>
74- # </cyboxCommon:Hash>
75- # </FileObj:Hashes>
76- # </cybox:Properties>
77- # </maecPackage:Malware_Instance_Object_Attributes>
78- # </maecPackage:Malware_Subject>
79- # </maecPackage:Malware_Subjects>
80- # </stix-maec:MAEC>
81- # """
82- # )
83- #
84- # def _test_xml(self, obj):
85- # xml = obj.to_xml()
86- # parser = mixbox.xml.get_xml_parser()
87- # tree = etree.parse(BytesIO(xml), parser=parser)
88- # root = tree.getroot()
89- #
90- # xpath = "//cyboxCommon:Type"
91- # nodes = root.xpath(xpath, namespaces={'cyboxCommon': 'http://cybox.mitre.org/common-2'})
92- #
93- # self.assertTrue(nodes is not None)
94- # self.assertEqual(len(nodes), 1)
95- # self.assertEqual(nodes[0].text, "MD5")
96- #
97- #
98- # def test_etree(self):
99- # parser = mixbox.xml.get_xml_parser()
100- # tree = etree.parse(StringIO(self.XML), parser=parser)
101- #
102- # ext = MAECInstance()
103- # ext.maec = tree
104- # self._test_xml(ext)
105- #
106- #
107- # def test_etree_dict(self):
108- # parser = mixbox.xml.get_xml_parser()
109- # tree = etree.parse(StringIO(self.XML), parser=parser)
110- # ext = MAECInstance()
111- # ext.maec = tree
112- #
113- # d = ext.to_dict()
114- # ext2 = MAECInstance.from_dict(d)
115- # self._test_xml(ext2)
116-
117-
11846class PythonMAECInPackageTests (unittest .TestCase ):
11947 XML = StringIO (
12048 """
121- <stix:STIX_Package
49+ <stix:STIX_Package
12250 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
12351 xmlns:stix="http://stix.mitre.org/stix-1"
12452 xmlns:stixCommon="http://stix.mitre.org/common-1"
@@ -130,7 +58,7 @@ class PythonMAECInPackageTests(unittest.TestCase):
13058 http://stix.mitre.org/common-1 http://stix.mitre.org/XMLSchema/common/1.2/stix_common.xsd
13159 http://stix.mitre.org/default_vocabularies-1 http://stix.mitre.org/XMLSchema/default_vocabularies/1.2.0/stix_default_vocabularies.xsd
13260 http://stix.mitre.org/stix-1 http://stix.mitre.org/XMLSchema/core/1.2/stix_core.xsd"
133- id="example:Package-2b8fb66f-b6b3-4d40-865a-33e4a5ee1246"
61+ id="example:Package-2b8fb66f-b6b3-4d40-865a-33e4a5ee1246"
13462 version="1.2"
13563 >
13664 <stix:TTPs>
@@ -151,7 +79,7 @@ class PythonMAECInPackageTests(unittest.TestCase):
15179 )
15280 XML_MAEC = StringIO (
15381 """
154- <stix:STIX_Package
82+ <stix:STIX_Package
15583 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
15684 xmlns:stix="http://stix.mitre.org/stix-1"
15785 xmlns:stixCommon="http://stix.mitre.org/common-1"
@@ -167,7 +95,7 @@ class PythonMAECInPackageTests(unittest.TestCase):
16795 http://stix.mitre.org/stix-1 http://stix.mitre.org/XMLSchema/core/1.2/stix_core.xsd
16896 http://stix.mitre.org/extensions/Malware#MAEC4.1-1 http://stix.mitre.org/XMLSchema/extensions/malware/maec_4.1/1.0/maec_4.1_malware.xsd
16997 http://maec.mitre.org/XMLSchema/maec-package-2 http://maec.mitre.org/language/version4.1/maec_package_schema.xsd"
170- id="example:Package-2b8fb66f-b6b3-4d40-865a-33e4a5ee1246"
98+ id="example:Package-2b8fb66f-b6b3-4d40-865a-33e4a5ee1246"
17199 version="1.2"
172100 >
173101 <stix:TTPs>
0 commit comments