mirror of https://github.com/MISP/PyMISP
fix: Make python2 happy.
parent
5520cf1261
commit
4e36ac34dc
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
import json
|
import json
|
||||||
|
import sys
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
from pymisp import MISPEvent, MISPSighting, MISPTag
|
from pymisp import MISPEvent, MISPSighting, MISPTag
|
||||||
|
@ -240,7 +241,11 @@ class TestMISPEvent(unittest.TestCase):
|
||||||
with self.assertRaises(InvalidMISPObject) as e:
|
with self.assertRaises(InvalidMISPObject) as e:
|
||||||
# Fail on required
|
# Fail on required
|
||||||
self.mispevent.to_json()
|
self.mispevent.to_json()
|
||||||
|
if sys.version_info >= (3, ):
|
||||||
self.assertEqual(e.exception.message, '{\'member3\'} are required.')
|
self.assertEqual(e.exception.message, '{\'member3\'} are required.')
|
||||||
|
else:
|
||||||
|
# Python2 bullshit
|
||||||
|
self.assertEqual(e.exception.message, 'set([u\'member3\']) are required.')
|
||||||
|
|
||||||
self.mispevent.objects[0].add_attribute('member3', value='foo')
|
self.mispevent.objects[0].add_attribute('member3', value='foo')
|
||||||
with self.assertRaises(InvalidMISPObject) as e:
|
with self.assertRaises(InvalidMISPObject) as e:
|
||||||
|
|
Loading…
Reference in New Issue