mirror of https://github.com/MISP/PyMISP
chg: Bump live tests
parent
93e3da2df9
commit
0bdfb3892d
|
@ -1157,9 +1157,9 @@ class PyMISP:
|
|||
t = self.get_taxonomy(taxonomy_id)
|
||||
if isinstance(t, MISPTaxonomy) and not t.enabled:
|
||||
# Can happen if global pythonify is enabled.
|
||||
raise PyMISPError(f"The taxonomy {t.name} is not enabled.")
|
||||
raise PyMISPError(f"The taxonomy {t.namespace} is not enabled.")
|
||||
elif not t['Taxonomy']['enabled']:
|
||||
raise PyMISPError(f"The taxonomy {t['Taxonomy']['name']} is not enabled.")
|
||||
raise PyMISPError(f"The taxonomy {t['Taxonomy']['namespace']} is not enabled.")
|
||||
url = urljoin(self.root_url, 'taxonomies/addTag/{}'.format(taxonomy_id))
|
||||
response = self._prepare_request('POST', url)
|
||||
return self._check_json_response(response)
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit d2b93f5aa69e0d9bfc549915b8f691cc5f62bf6c
|
||||
Subproject commit 238fc99b6019db9b41185794fe53590af69a17d1
|
|
@ -2054,14 +2054,17 @@ class MISPWarninglist(AbstractMISP):
|
|||
|
||||
class MISPTaxonomy(AbstractMISP):
|
||||
|
||||
name: str
|
||||
enabled: bool
|
||||
namespace: str
|
||||
|
||||
def from_dict(self, **kwargs):
|
||||
if 'Taxonomy' in kwargs:
|
||||
kwargs = kwargs['Taxonomy']
|
||||
super().from_dict(**kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return f'<{self.__class__.__name__}(namespace={self.namespace})>'
|
||||
|
||||
|
||||
class MISPNoticelist(AbstractMISP):
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
{"type": "bundle", "spec_version": "2.0", "id": "bundle--811070d5-8e95-43c1-8af3-0b5e799dc15c", "objects": [{"type": "identity", "id": "identity--5d397c4b-3474-466a-80cd-624838d4ff94", "name": "ORGNAME", "identity_class": "organization", "created": "2021-08-24T10:53:42.879Z", "modified": "2021-08-24T10:53:42.879Z"}, {"type": "report", "id": "report--f90bb8c1-8505-4d74-af34-3dcffec6b6d4", "name": "Test Stix", "created": "2021-08-24T00:00:00.000Z", "published": "2021-08-24T10:53:28Z", "modified": "2021-08-24T10:53:13.000Z", "created_by_ref": "identity--5d397c4b-3474-466a-80cd-624838d4ff94", "labels": ["Threat-Report", "misp:tool=\"misp2stix2\""], "object_refs": ["observed-data--0853d51f-0fe7-4d35-b3cb-b96bdbc1f0ee"]}, {"id": "observed-data--0853d51f-0fe7-4d35-b3cb-b96bdbc1f0ee", "type": "observed-data", "number_observed": 1, "objects": {"0": {"type": "ipv4-addr", "value": "8.8.8.8"}, "1": {"type": "network-traffic", "src_ref": "0", "protocols": ["ipv4"]}}, "created_by_ref": "identity--5d397c4b-3474-466a-80cd-624838d4ff94", "labels": ["misp:type=\"ip-src\"", "misp:category=\"Network activity\"", "misp:to_ids=\"False\""], "created": "2021-08-24T10:53:13.000Z", "modified": "2021-08-24T10:53:13.000Z", "first_observed": "2021-08-24T10:53:13Z", "last_observed": "2021-08-24T10:53:13Z"}]}
|
|
@ -1318,8 +1318,6 @@ class TestComprehensive(unittest.TestCase):
|
|||
# The existing_object is a overwrite_file object, unless we uncomment the line above, type= is required below.
|
||||
existing_object.add_attribute('pattern-in-file', value='foo', type='text')
|
||||
updated_existing_object = self.admin_misp_connector.update_object(existing_object, pythonify=True)
|
||||
print(updated_existing_object.to_json(indent=2))
|
||||
print(updated_existing_object.get_attributes_by_relation('pattern-in-file'))
|
||||
self.assertEqual(updated_existing_object.get_attributes_by_relation('pattern-in-file')[0].value, 'foo', updated_existing_object)
|
||||
|
||||
finally:
|
||||
|
@ -1332,6 +1330,10 @@ class TestComprehensive(unittest.TestCase):
|
|||
{'MyCoolerAttribute': {'value': 'even worse', 'type': 'text', 'disable_correlation': True}}]
|
||||
misp_object = GenericObjectGenerator('my-cool-template')
|
||||
misp_object.generate_attributes(attributeAsDict)
|
||||
misp_object.template_uuid = uuid4()
|
||||
misp_object.template_id = 1
|
||||
misp_object.description = 'bar'
|
||||
setattr(misp_object, 'meta-category', 'foo')
|
||||
first.add_object(misp_object)
|
||||
blah_object = MISPObject('BLAH_TEST')
|
||||
blah_object.template_uuid = uuid4()
|
||||
|
@ -1343,7 +1345,7 @@ class TestComprehensive(unittest.TestCase):
|
|||
first.add_object(blah_object)
|
||||
try:
|
||||
first = self.user_misp_connector.add_event(first)
|
||||
self.assertEqual(len(first.objects[0].attributes), 2)
|
||||
self.assertEqual(len(first.objects[0].attributes), 2, first.objects[0].attributes)
|
||||
self.assertFalse(first.objects[0].attributes[0].disable_correlation)
|
||||
self.assertTrue(first.objects[0].attributes[1].disable_correlation)
|
||||
self.assertTrue(first.objects[1].attributes[0].disable_correlation)
|
||||
|
|
Loading…
Reference in New Issue