From ffbf5fa34cf26a84e03d3c704c934c22d2eb63b8 Mon Sep 17 00:00:00 2001 From: "Desai, Kartikey H" Date: Mon, 1 Jul 2019 15:41:44 -0400 Subject: [PATCH] Fix JSON encoding issue within tests --- stix2/test/v21/test_bundle.py | 2 +- stix2/test/v21/test_environment.py | 2 +- stix2/test/v21/test_indicator.py | 3 ++- stix2/test/v21/test_malware.py | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/stix2/test/v21/test_bundle.py b/stix2/test/v21/test_bundle.py index 9b78215..a884b1f 100644 --- a/stix2/test/v21/test_bundle.py +++ b/stix2/test/v21/test_bundle.py @@ -32,7 +32,7 @@ EXPECTED_BUNDLE = """{ "malware_types": [ "ransomware" ], - "is_family": False + "is_family": "False" }, { "type": "relationship", diff --git a/stix2/test/v21/test_environment.py b/stix2/test/v21/test_environment.py index 53ab744..6887e41 100644 --- a/stix2/test/v21/test_environment.py +++ b/stix2/test/v21/test_environment.py @@ -220,7 +220,7 @@ def test_parse_malware(): "malware_types": [ "ransomware" ], - "is_family": False + "is_family": "False" }""" mal = env.parse(data, version="2.1") diff --git a/stix2/test/v21/test_indicator.py b/stix2/test/v21/test_indicator.py index d061104..b68b887 100644 --- a/stix2/test/v21/test_indicator.py +++ b/stix2/test/v21/test_indicator.py @@ -99,7 +99,7 @@ def test_indicator_required_properties(): assert excinfo.value.cls == stix2.v21.Indicator assert excinfo.value.properties == ["indicator_types", "pattern", "valid_from"] - assert str(excinfo.value) == "No values for required properties for Indicator: (indicator_types, pattern)." + assert str(excinfo.value) == "No values for required properties for Indicator: (indicator_types, pattern, valid_from)." def test_indicator_required_property_pattern(): @@ -194,6 +194,7 @@ def test_invalid_indicator_pattern(): stix2.v21.Indicator( indicator_types=['malicious-activity'], pattern='[file:hashes.MD5 = "d41d8cd98f00b204e9800998ecf8427e"]', + valid_from="2017-01-01T12:34:56Z", ) assert excinfo.value.cls == stix2.v21.Indicator assert excinfo.value.prop_name == 'pattern' diff --git a/stix2/test/v21/test_malware.py b/stix2/test/v21/test_malware.py index e6dfc2e..bf5b538 100644 --- a/stix2/test/v21/test_malware.py +++ b/stix2/test/v21/test_malware.py @@ -18,7 +18,7 @@ EXPECTED_MALWARE = """{ "malware_types": [ "ransomware" ], - "is_family": False + "is_family": "False" }"""