From 84fc71add45dab3f4b7ff4508b3fe6392a3d77d8 Mon Sep 17 00:00:00 2001 From: "Desai, Kartikey H" Date: Fri, 19 Apr 2019 12:17:42 -0400 Subject: [PATCH] Add test to ensure fix. Fixes #248 --- stix2/test/v20/test_malware.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/stix2/test/v20/test_malware.py b/stix2/test/v20/test_malware.py index d0c6d7e..900a4b9 100644 --- a/stix2/test/v20/test_malware.py +++ b/stix2/test/v20/test_malware.py @@ -35,6 +35,22 @@ def test_malware_with_all_required_properties(): assert str(mal) == EXPECTED_MALWARE +def test_malware_with_empty_optional_field(): + now = dt.datetime(2016, 5, 12, 8, 17, 27, tzinfo=pytz.utc) + + mal = stix2.v20.Malware( + type="malware", + id=MALWARE_ID, + created=now, + modified=now, + labels=["ransomware"], + name="Cryptolocker", + external_references=[], + ) + + assert str(mal) == EXPECTED_MALWARE + + def test_malware_autogenerated_properties(malware): assert malware.type == 'malware' assert malware.id == 'malware--00000000-0000-4000-8000-000000000001'