From 4b21708e03027390c3dfca4b85b9356c9e44fc96 Mon Sep 17 00:00:00 2001 From: Emmanuelle Vargas-Gonzalez Date: Fri, 3 May 2019 11:05:32 -0400 Subject: [PATCH] modify test to cover exception message --- stix2/test/v20/test_marking_definition.py | 4 +++- stix2/test/v21/test_marking_definition.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/stix2/test/v20/test_marking_definition.py b/stix2/test/v20/test_marking_definition.py index 9d03ebe..106a455 100644 --- a/stix2/test/v20/test_marking_definition.py +++ b/stix2/test/v20/test_marking_definition.py @@ -71,13 +71,15 @@ def test_bad_created_marking_tlp_amber(): def test_bad_created_marking_tlp_red(): - with pytest.raises(exceptions.TLPMarkingDefinitionError): + with pytest.raises(exceptions.TLPMarkingDefinitionError) as excinfo: MarkingDefinition( id='marking-definition--5e57c739-391a-4eb3-b6be-7d15ca92d5ed', definition_type='tlp', definition=TLPMarking(tlp='red'), ) + assert "marking-definition--5e57c739-391a-4eb3-b6be-7d15ca92d5ed" in str(excinfo.value) + def test_successful_tlp_white(): white = MarkingDefinition( diff --git a/stix2/test/v21/test_marking_definition.py b/stix2/test/v21/test_marking_definition.py index 2404ad1..dd3325f 100644 --- a/stix2/test/v21/test_marking_definition.py +++ b/stix2/test/v21/test_marking_definition.py @@ -71,13 +71,15 @@ def test_bad_created_marking_tlp_amber(): def test_bad_created_marking_tlp_red(): - with pytest.raises(exceptions.TLPMarkingDefinitionError): + with pytest.raises(exceptions.TLPMarkingDefinitionError) as excinfo: MarkingDefinition( id='marking-definition--5e57c739-391a-4eb3-b6be-7d15ca92d5ed', definition_type='tlp', definition=TLPMarking(tlp='red'), ) + assert "marking-definition--5e57c739-391a-4eb3-b6be-7d15ca92d5ed" in str(excinfo.value) + def test_successful_tlp_white(): white = MarkingDefinition(