def test_incident(self): i = Incident() i.title = UNICODE_STR i.description = UNICODE_STR i.short_description = UNICODE_STR i2 = round_trip(i) self._test_equal(i, i2)
def test_ta(self): t = ThreatActor() t.title = UNICODE_STR t.description = UNICODE_STR t.short_description = UNICODE_STR t2 = round_trip(t) self._test_equal(t, t2)
def test_campaign(self): c = Campaign() c.title = UNICODE_STR c.description = UNICODE_STR c.short_description = UNICODE_STR c2 = round_trip(c) self._test_equal(c, c2)
def test_ttp(self): t = TTP() t.title = UNICODE_STR t.description = UNICODE_STR t.short_description = UNICODE_STR t2 = round_trip(t) self._test_equal(t, t2)
def test_stix_header(self): header = STIXHeader() header.title = UNICODE_STR header.description = UNICODE_STR header.short_description = UNICODE_STR header2 = round_trip(header) self._test_equal(header, header2)
def test_et(self): e = ExploitTarget() e.title = UNICODE_STR e.description = UNICODE_STR e.short_description = UNICODE_STR e2 = round_trip(e) self._test_equal(e, e2)
def test_shortcut_dict_representation(self): """If precision is the default value, to_dict should return a string""" date_str = "2013-11-17T01:03:05" d = DateTimeWithPrecision() d.precision = "second" d.value = date_str self.assertEqual(str, type(d.to_dict())) self.assertEqual(datetime.datetime, type(d.value)) self.assertEqual(date_str, d.to_dict()) d2 = round_trip(d, output=True) self.assertEqual(d.to_dict(), d2.to_dict())
def test_structured_text(self): s = StructuredText(UNICODE_STR) s2 = round_trip(s) self.assertEqual(s.value, s2.value)
def test_asset_type(self): a = affected_asset.AssetType() a.count_affected = 1 a2 = round_trip(a) self.assertEqual(a.count_affected, a2.count_affected)