Пример #1
0
 def test_sighting(self):
     sighting = MISPSighting()
     sighting.from_dict(value='1', type='bar', timestamp=11111111)
     with open('tests/mispevent_testfiles/sighting.json', 'r') as f:
         ref_json = json.load(f)
     self.assertEqual(sighting.to_json(sort_keys=True, indent=2),
                      json.dumps(ref_json, sort_keys=True, indent=2))
Пример #2
0
 def sighting(self, value, source):
     if self.offline:
         raise Exception('The script is running in offline mode, ')
     '''Add a sighting'''
     s = MISPSighting()
     s.from_dict(value=value, source=source)
     self.misp.add_sighting(s)
Пример #3
0
 def test_sighting(self):
     sighting = MISPSighting()
     sighting.from_dict(value='1', type='bar', timestamp=11111111)
     with open('tests/mispevent_testfiles/sighting.json', 'r') as f:
         ref_json = json.load(f)
     self.assertEqual(sighting.to_json(), json.dumps(ref_json, sort_keys=True, indent=2))