Merge branch 'master' of github.com:oasis-open/cti-python-stix2
						commit
						92c0582d8f
					
				|  | @ -144,12 +144,12 @@ class _STIXBase(collections.Mapping): | |||
|         if custom_props: | ||||
|             self.__allow_custom = True | ||||
| 
 | ||||
|         # Remove any keyword arguments whose value is None | ||||
|         # Remove any keyword arguments whose value is None or [] (i.e. empty list) | ||||
|         setting_kwargs = {} | ||||
|         props = kwargs.copy() | ||||
|         props.update(custom_props) | ||||
|         for prop_name, prop_value in props.items(): | ||||
|             if prop_value is not None: | ||||
|             if prop_value is not None and prop_value != []: | ||||
|                 setting_kwargs[prop_name] = prop_value | ||||
| 
 | ||||
|         # Detect any missing required properties | ||||
|  |  | |||
|  | @ -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' | ||||
|  |  | |||
|  | @ -107,7 +107,6 @@ def test_add_markings_combination(): | |||
|     "data", [ | ||||
|         ([""]), | ||||
|         (""), | ||||
|         ([]), | ||||
|         ([MARKING_IDS[0], 456]), | ||||
|     ], | ||||
| ) | ||||
|  | @ -576,7 +575,6 @@ def test_set_marking(): | |||
| 
 | ||||
| @pytest.mark.parametrize( | ||||
|     "data", [ | ||||
|         ([]), | ||||
|         ([""]), | ||||
|         (""), | ||||
|         ([MARKING_IDS[4], 687]), | ||||
|  |  | |||
|  | @ -106,7 +106,6 @@ def test_add_markings_combination(): | |||
|     "data", [ | ||||
|         ([""]), | ||||
|         (""), | ||||
|         ([]), | ||||
|         ([MARKING_IDS[0], 456]), | ||||
|     ], | ||||
| ) | ||||
|  | @ -575,7 +574,6 @@ def test_set_marking(): | |||
| 
 | ||||
| @pytest.mark.parametrize( | ||||
|     "data", [ | ||||
|         ([]), | ||||
|         ([""]), | ||||
|         (""), | ||||
|         ([MARKING_IDS[4], 687]), | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 chrisr3d
						chrisr3d