-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename type to type_ in several objects. Fix #267
- Loading branch information
Showing
9 changed files
with
146 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Copyright (c) 2015, The MITRE Corporation. All rights reserved. | ||
# See LICENSE.txt for complete terms. | ||
|
||
import unittest | ||
|
||
from mixbox.vendor.six import u | ||
|
||
from cybox.objects.disk_partition_object import DiskPartition | ||
from cybox.test.objects import ObjectTestCase | ||
|
||
|
||
class TestDiskPartition(ObjectTestCase, unittest.TestCase): | ||
object_type = "DiskPartitionObjectType" | ||
klass = DiskPartition | ||
|
||
_full_dict = { | ||
'created': "2007-10-05T07:14:21+00:00", | ||
'device_name': u("C partition"), | ||
'mount_point': u("C:"), | ||
'partition_id': 8, | ||
'partition_length': 5000000, | ||
'partition_offset': 1000000, | ||
'space_left': 50000, | ||
'space_used': 50001, | ||
'total_space': 100001, | ||
'type': "PARTITION_FAT_12", | ||
'xsi:type': object_type, | ||
} | ||
|
||
# https://github.com/CybOXProject/python-cybox/issues/267 | ||
def test_type(self): | ||
partition = DiskPartition() | ||
partition.type_ = "PARTITION_FAT32" | ||
self.assertTrue(b"PARTITION_FAT32" in partition.to_xml()) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright (c) 2015, The MITRE Corporation. All rights reserved. | ||
# See LICENSE.txt for complete terms. | ||
|
||
import unittest | ||
|
||
from mixbox.vendor.six import u | ||
|
||
from cybox.objects.disk_object import Disk | ||
from cybox.test.objects import ObjectTestCase | ||
|
||
|
||
class TestDisk(ObjectTestCase, unittest.TestCase): | ||
object_type = "DiskObjectType" | ||
klass = Disk | ||
|
||
_full_dict = { | ||
'disk_name': u("A disk"), | ||
'disk_size': 12345678, | ||
'free_space': 1234567, | ||
'partition_list': [ | ||
{ | ||
'device_name': u("A partition"), | ||
'xsi:type': "DiskPartitionObjectType", | ||
}, | ||
{ | ||
'device_name': u("B partition"), | ||
'xsi:type': "DiskPartitionObjectType", | ||
}, | ||
], | ||
'type': u("Fixed"), | ||
'xsi:type': object_type, | ||
} | ||
|
||
# https://github.com/CybOXProject/python-cybox/issues/267 | ||
def test_type(self): | ||
disk = Disk() | ||
disk.type_ = "Fixed" | ||
self.assertTrue(b"Fixed" in disk.to_xml()) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Copyright (c) 2015, The MITRE Corporation. All rights reserved. | ||
# See LICENSE.txt for complete terms. | ||
|
||
import unittest | ||
|
||
from mixbox.vendor.six import u | ||
|
||
from cybox.objects.win_event_log_object import WinEventLog | ||
from cybox.test.objects import ObjectTestCase | ||
|
||
|
||
class TestWinEventLog(ObjectTestCase, unittest.TestCase): | ||
object_type = "WindowsEventLogObjectType" | ||
klass = WinEventLog | ||
|
||
_full_dict = { | ||
'eid': 4000000, | ||
'type': u("warning"), | ||
'log': u("Bad things that happened"), | ||
'message': u("Something bad happened"), | ||
'category_num': 43, | ||
'category': u("Things that go bump in the night"), | ||
'generation_time': "2014-10-05T07:14:21+00:00", | ||
'source': u("Under the bed"), | ||
'machine': u("apple"), | ||
'user': u("Timmy"), | ||
'blob': u("d234b6LKJSBLKB2453452"), | ||
'correlation_activity_id': u("abc123"), | ||
'correlation_related_activity_id': u("def456"), | ||
'execution_process_id': u("ghi789"), | ||
'execution_thread_id': u("jkl0ab"), | ||
'index': 123456789, | ||
'reserved': 0x654c664c, | ||
'unformatted_message_list': [ | ||
u("I looked under the bed"), | ||
u("and saw"), | ||
u("a monster"), | ||
], | ||
'write_time': "2014-10-05T08:14:21+00:00", | ||
'xsi:type': "WindowsEventLogObjectType", | ||
} | ||
|
||
# https://github.com/CybOXProject/python-cybox/issues/267 | ||
def test_type(self): | ||
log = WinEventLog() | ||
log.type_ = "Success" | ||
self.assertTrue(b"Success" in log.to_xml()) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters