Skip to content

Commit

Permalink
Add failing unit test for #230
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsamuels committed Oct 17, 2018
1 parent a29885b commit f515c06
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions libtaxii/test/messages_11_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,27 @@ def test_status_message_11(self):
kwargs = {'message_id': '1', 'in_response_to': '2', 'status_type': ST_FAILURE, 'message': {}}
self.assertRaises(ValueError, tm11.StatusMessage, **kwargs)

def test_status_message_12(self):
# https://github.com/TAXIIProject/libtaxii/issues/230
collections = ['Collection1', 'Collection2', 'Collection3']
sm12 = tm11.StatusMessage(
message_id='SM12', # Required
in_response_to=tm11.generate_message_id(), # Required, should be the ID of the message that this is in response to
status_type=ST_DESTINATION_COLLECTION_ERROR, # Required
status_detail={'ACCEPTABLE_DESTINATION': collections}, # Add 3 collections to trigger the bug
message=None # Optional
)
round_trip_message(sm12)

self.assertEqual(sm12.status_detail['ACCEPTABLE_DESTINATION'], collections)

# Parse the XML
parsed_sm12 = tm11.StatusMessage.from_xml(sm12.to_xml())

# If the bug is present the value returned will be:
# [['Collection1', 'Collection2'], 'Collection3']
self.assertEqual(parsed_sm12.status_detail['ACCEPTABLE_DESTINATION'], collections)

# TODO: TEst the query status types

def test_xml_ext_header(self):
Expand Down

0 comments on commit f515c06

Please sign in to comment.