Skip to content

Commit 6299ff9

Browse files
committed
Add v21 test for GranularMarking to close #586.
1 parent d2d7161 commit 6299ff9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

stix2/test/v21/test_markings.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,18 @@ def test_granular_example_with_bad_selector():
170170
assert str(excinfo.value) == "Invalid value for GranularMarking 'selectors': must adhere to selector syntax."
171171

172172

173+
def test_granular_marking_mutual_exclusion_error():
174+
with pytest.raises(stix2.exceptions.MutuallyExclusivePropertiesError) as excinfo:
175+
stix2.v21.GranularMarking(
176+
lang="en",
177+
marking_ref=stix2.TLP_GREEN,
178+
selectors=["foo"]
179+
)
180+
assert excinfo.value.cls == stix2.v21.GranularMarking
181+
assert excinfo.value.properties == ["lang", "marking_ref"]
182+
assert 'are mutually exclusive' in str(excinfo.value)
183+
184+
173185
def test_campaign_with_granular_markings_example():
174186
campaign = stix2.v21.Campaign(
175187
id="campaign--8e2e2d2b-17d4-4cbf-938f-98ee46b3cd3f",

0 commit comments

Comments
 (0)