chg: Add test related to travis

pull/471/head
Raphaël Vinot 2019-08-19 11:30:53 +02:00
parent 11e754681d
commit 4995ff731d
1 changed files with 6 additions and 7 deletions

View File

@ -1396,13 +1396,12 @@ class TestComprehensive(unittest.TestCase):
attr4.type = 'ip-dst'
attr4.add_tag('tlp:amber___test')
response = self.user_misp_connector.add_attribute(first, [attr1, attr2, attr3, attr4])
if 'attributes' in response:
# FIXME: this if statement can be removed as soon as 2.4.113 is released: the format changed between 112 and 113, we test 113+
self.assertEqual(response['attributes'][0].value, '1.2.3.5')
self.assertEqual(response['attributes'][1].value, '1.2.3.6')
self.assertEqual(response['attributes'][1].tags[0].name, 'tlp:amber___test')
self.assertEqual(response['errors']['attribute_0']['value'][0], 'A similar attribute already exists for this event.')
self.assertEqual(response['errors']['attribute_2']['value'][0], 'A similar attribute already exists for this event.')
self.assertEqual(response['attributes'][0].value, '1.2.3.5')
self.assertEqual(response['attributes'][1].value, '1.2.3.6')
self.assertEqual(isinstance(response['attributes'][1].tags, list), response['attributes'][1].to_json())
self.assertEqual(response['attributes'][1].tags[0].name, 'tlp:amber___test')
self.assertEqual(response['errors']['attribute_0']['value'][0], 'A similar attribute already exists for this event.')
self.assertEqual(response['errors']['attribute_2']['value'][0], 'A similar attribute already exists for this event.')
# Add attribute as proposal
new_proposal = MISPAttribute()