def get_handling(entity): _load_stix() try: header = entity.stix_header if not header: header = stix_core.STIXHeader() entity.stix_header = header base = header except AttributeError: # Entity was not a STIXPackage instance. base = entity if hasattr(base, "handling") and not base.handling: base.handling = stix_dm.Marking() # Handles stix.Report Handling case. elif hasattr(base, "header"): if not base.header: base.header = stix_report.header.Header() if not base.header.handling: base.header.handling = stix_dm.Marking() return base.header.handling return base.handling
def test_duplicate_package_intent(self): # Recreate https://github.com/STIXProject/python-stix/issues/63 hdr = core.STIXHeader(package_intents=["Indicators - Watchlist"]) self.assertEqual(1, len(hdr.package_intents))
def test_deprecated_package_intents(self): h = core.STIXHeader() h.package_intents = PackageIntent.TERM_INCIDENT self.assertEqual(str(h.package_intents[0]), PackageIntent.TERM_INCIDENT)
def test_deprecated_short_description(self): h = core.STIXHeader() sd = "short_description" h.short_description = sd self.assertEqual(str(h.short_description), sd)
def test_deprecated_description(self): h = core.STIXHeader() d = "description" h.description = d self.assertEqual(str(h.description), d)
def test_deprecated_title(self): h = core.STIXHeader() t = "title" h.title = t self.assertEqual(h.title, t)