Initial version of the offline TestCases

Related #56
pull/30/head
Raphaël Vinot 2016-08-17 18:21:50 +02:00
parent 709770e367
commit 0134e2a9e3
1 changed files with 28 additions and 0 deletions

28
tests/test_offline.py Normal file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests_mock
import json
from pymisp import PyMISP
@requests_mock.Mocker()
class TestOffline(object):
def setUp(self):
self.domain = 'http://misp.local/'
self.key = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
self.event = json.load(open('misp_event.json', 'r'))
self.types = json.load(open('describeTypes.json', 'r'))
def initURI(self, m):
m.register_uri('GET', self.domain + 'servers/getVersion', json={"version": "2.4.50"})
m.register_uri('GET', self.domain + 'attributes/describeTypes.json', json=self.types)
m.register_uri('GET', self.domain + 'events/2', json=self.event)
def test_getEvent(self, m):
self.initURI(m)
pymisp = PyMISP(self.domain, self.key, debug=True)
e = pymisp.get_event(2)
print(e)