mirror of https://github.com/MISP/PyMISP
Add tag test
parent
c80bef0e0d
commit
3d6fa51a7a
|
@ -64,6 +64,8 @@ class TestOffline(unittest.TestCase):
|
||||||
m.register_uri('POST', self.domain + 'attributes/downloadSample', json={})
|
m.register_uri('POST', self.domain + 'attributes/downloadSample', json={})
|
||||||
m.register_uri('GET', self.domain + 'tags', json={'Tag': 'foo'})
|
m.register_uri('GET', self.domain + 'tags', json={'Tag': 'foo'})
|
||||||
m.register_uri('POST', self.domain + 'events/upload_sample/1', json={})
|
m.register_uri('POST', self.domain + 'events/upload_sample/1', json={})
|
||||||
|
m.register_uri('POST', self.domain + 'tags/attachTagToObject', json={})
|
||||||
|
m.register_uri('POST', self.domain + 'tags/removeTagFromObject', json={})
|
||||||
|
|
||||||
def test_getEvent(self, m):
|
def test_getEvent(self, m):
|
||||||
self.initURI(m)
|
self.initURI(m)
|
||||||
|
@ -440,18 +442,30 @@ class TestOffline(unittest.TestCase):
|
||||||
pymisp = PyMISP(self.domain, self.key)
|
pymisp = PyMISP(self.domain, self.key)
|
||||||
self.assertEqual((False, None), pymisp.download_samples())
|
self.assertEqual((False, None), pymisp.download_samples())
|
||||||
|
|
||||||
|
|
||||||
def test_sample_upload(self, m):
|
def test_sample_upload(self, m):
|
||||||
self.initURI(m)
|
self.initURI(m)
|
||||||
pymisp = PyMISP(self.domain, self.key)
|
pymisp = PyMISP(self.domain, self.key)
|
||||||
upload = pymisp.upload_sample("tmux", "tests/viper-test-files/test_files/tmux" , 1)
|
upload = pymisp.upload_sample("tmux", "tests/viper-test-files/test_files/tmux" , 1)
|
||||||
|
|
||||||
|
|
||||||
def test_get_all_tags(self, m):
|
def test_get_all_tags(self, m):
|
||||||
self.initURI(m)
|
self.initURI(m)
|
||||||
pymisp = PyMISP(self.domain, self.key)
|
pymisp = PyMISP(self.domain, self.key)
|
||||||
self.assertEqual({'Tag': 'foo'}, pymisp.get_all_tags())
|
self.assertEqual({'Tag': 'foo'}, pymisp.get_all_tags())
|
||||||
|
|
||||||
|
def test_tag_event(self, m):
|
||||||
|
self.initURI(m)
|
||||||
|
pymisp = PyMISP(self.domain, self.key)
|
||||||
|
uuid = self.event["Event"]["uuid"]
|
||||||
|
pymisp.tag(uuid, "foo")
|
||||||
|
|
||||||
|
self.assertRaises(pm.PyMISPError, pymisp.tag, "test_uuid", "foo")
|
||||||
|
self.assertRaises(pm.PyMISPError, pymisp.tag, uuid.replace("a", "z"), "foo")
|
||||||
|
|
||||||
|
def test_untag_event(self, m):
|
||||||
|
self.initURI(m)
|
||||||
|
pymisp = PyMISP(self.domain, self.key)
|
||||||
|
uuid = self.event["Event"]["uuid"]
|
||||||
|
pymisp.untag(uuid, "foo")
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Reference in New Issue