Correct "image_weight" to "image_width".

Fix #194.
stix2.0
Greg Back 2018-06-20 15:24:27 -05:00
parent 2ec5ba44f8
commit 7baeb153fa
2 changed files with 46 additions and 1 deletions

View File

@ -765,6 +765,51 @@ def test_file_example_with_RasterImageExt_Object():
assert f.extensions["raster-image-ext"].exif_tags["XResolution"] == 4928
RASTER_IMAGE_EXT = """{
"type": "observed-data",
"id": "observed-data--b67d30ff-02ac-498a-92f9-32f845f448cf",
"created": "2016-04-06T19:58:16.000Z",
"modified": "2016-04-06T19:58:16.000Z",
"first_observed": "2015-12-21T19:00:00Z",
"last_observed": "2015-12-21T19:00:00Z",
"number_observed": 1,
"objects": {
"0": {
"type": "file",
"name": "picture.jpg",
"hashes": {
"SHA-256": "35a01331e9ad96f751278b891b6ea09699806faedfa237d40513d92ad1b7100f"
},
"extensions": {
"raster-image-ext": {
"image_height": 768,
"image_width": 1024,
"bits_per_pixel": 72,
"image_compression_algorithm": "JPEG",
"exif_tags": {
"Make": "Nikon",
"Model": "D7000",
"XResolution": 4928,
"YResolution": 3264
}
}
}
}
}
}
"""
def test_raster_image_ext_parse():
obj = stix2.parse(RASTER_IMAGE_EXT, allow_custom=False)
assert obj.objects["0"].extensions['raster-image-ext'].image_width == 1024
def test_raster_images_ext_create():
ext = stix2.RasterImageExt(image_width=1024)
assert "image_width" in str(ext)
def test_file_example_with_WindowsPEBinaryExt():
f = stix2.File(name="qwerty.dll",
extensions={

View File

@ -302,7 +302,7 @@ class RasterImageExt(_Extension):
_properties = OrderedDict()
_properties.update([
('image_height', IntegerProperty()),
('image_weight', IntegerProperty()),
('image_width', IntegerProperty()),
('bits_per_pixel', IntegerProperty()),
('image_compression_algorithm', StringProperty()),
('exif_tags', DictionaryProperty()),