Skip to content

Commit

Permalink
Remove commented test.
Browse files Browse the repository at this point in the history
  • Loading branch information
gtback committed Feb 27, 2018
1 parent f37e711 commit 97a105b
Showing 1 changed file with 4 additions and 76 deletions.
80 changes: 4 additions & 76 deletions stix/test/extensions/malware/maec_4_1_malware_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,82 +43,10 @@ def test_add_name_type(self):
self.assertTrue("Remote Access Trojan" in maec_xml)


# This test no longer reflects the proper usage of the MAECInstance object
# class PythonMAECEtreeTests(unittest.TestCase):
# XML = (
# """
# <stix-maec:MAEC
# xmlns:cyboxCommon="http://cybox.mitre.org/common-2"
# xmlns:cybox="http://cybox.mitre.org/cybox-2"
# xmlns:cyboxVocabs="http://cybox.mitre.org/default_vocabularies-2"
# xmlns:FileObj="http://cybox.mitre.org/objects#FileObject-2"
# xmlns:example="http://example.com"
# xmlns:maecPackage="http://maec.mitre.org/XMLSchema/maec-package-2"
# xmlns:maecVocabs="http://maec.mitre.org/default_vocabularies-1"
# xmlns:ttp="http://stix.mitre.org/TTP-1"
# xmlns:stixCommon="http://stix.mitre.org/common-1"
# xmlns:stixVocabs="http://stix.mitre.org/default_vocabularies-1"
# xmlns:stix-maec="http://stix.mitre.org/extensions/Malware#MAEC4.1-1"
# xmlns:stix="http://stix.mitre.org/stix-1"
# xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
# xsi:type='stix-maec:MAEC4.1InstanceType'
# id="example:package-2fb96bef-1b11-436e-af4a-15588ac3198b" schema_version="2.1">
# <maecPackage:Malware_Subjects>
# <maecPackage:Malware_Subject>
# <maecPackage:Malware_Instance_Object_Attributes id="maec-tst-obj-1">
# <cybox:Properties xsi:type="FileObj:FileObjectType">
# <FileObj:Hashes>
# <cyboxCommon:Hash>
# <cyboxCommon:Type xsi:type="cyboxVocabs:HashNameVocab-1.0">MD5</cyboxCommon:Type>
# <cyboxCommon:Simple_Hash_Value>9d7006e30fdf15e9c8e03e62534b3a3e</cyboxCommon:Simple_Hash_Value>
# </cyboxCommon:Hash>
# </FileObj:Hashes>
# </cybox:Properties>
# </maecPackage:Malware_Instance_Object_Attributes>
# </maecPackage:Malware_Subject>
# </maecPackage:Malware_Subjects>
# </stix-maec:MAEC>
# """
# )
#
# def _test_xml(self, obj):
# xml = obj.to_xml()
# parser = mixbox.xml.get_xml_parser()
# tree = etree.parse(BytesIO(xml), parser=parser)
# root = tree.getroot()
#
# xpath = "//cyboxCommon:Type"
# nodes = root.xpath(xpath, namespaces={'cyboxCommon': 'http://cybox.mitre.org/common-2'})
#
# self.assertTrue(nodes is not None)
# self.assertEqual(len(nodes), 1)
# self.assertEqual(nodes[0].text, "MD5")
#
#
# def test_etree(self):
# parser = mixbox.xml.get_xml_parser()
# tree = etree.parse(StringIO(self.XML), parser=parser)
#
# ext = MAECInstance()
# ext.maec = tree
# self._test_xml(ext)
#
#
# def test_etree_dict(self):
# parser = mixbox.xml.get_xml_parser()
# tree = etree.parse(StringIO(self.XML), parser=parser)
# ext = MAECInstance()
# ext.maec = tree
#
# d = ext.to_dict()
# ext2 = MAECInstance.from_dict(d)
# self._test_xml(ext2)


class PythonMAECInPackageTests(unittest.TestCase):
XML = StringIO(
"""
<stix:STIX_Package
<stix:STIX_Package
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:stix="http://stix.mitre.org/stix-1"
xmlns:stixCommon="http://stix.mitre.org/common-1"
Expand All @@ -130,7 +58,7 @@ class PythonMAECInPackageTests(unittest.TestCase):
http://stix.mitre.org/common-1 http://stix.mitre.org/XMLSchema/common/1.2/stix_common.xsd
http://stix.mitre.org/default_vocabularies-1 http://stix.mitre.org/XMLSchema/default_vocabularies/1.2.0/stix_default_vocabularies.xsd
http://stix.mitre.org/stix-1 http://stix.mitre.org/XMLSchema/core/1.2/stix_core.xsd"
id="example:Package-2b8fb66f-b6b3-4d40-865a-33e4a5ee1246"
id="example:Package-2b8fb66f-b6b3-4d40-865a-33e4a5ee1246"
version="1.2"
>
<stix:TTPs>
Expand All @@ -151,7 +79,7 @@ class PythonMAECInPackageTests(unittest.TestCase):
)
XML_MAEC = StringIO(
"""
<stix:STIX_Package
<stix:STIX_Package
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:stix="http://stix.mitre.org/stix-1"
xmlns:stixCommon="http://stix.mitre.org/common-1"
Expand All @@ -167,7 +95,7 @@ class PythonMAECInPackageTests(unittest.TestCase):
http://stix.mitre.org/stix-1 http://stix.mitre.org/XMLSchema/core/1.2/stix_core.xsd
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
http://maec.mitre.org/XMLSchema/maec-package-2 http://maec.mitre.org/language/version4.1/maec_package_schema.xsd"
id="example:Package-2b8fb66f-b6b3-4d40-865a-33e4a5ee1246"
id="example:Package-2b8fb66f-b6b3-4d40-865a-33e4a5ee1246"
version="1.2"
>
<stix:TTPs>
Expand Down

0 comments on commit 97a105b

Please sign in to comment.