From b42b1cafa7f8ecb1ade7b2ff9953415cf129364e Mon Sep 17 00:00:00 2001 From: Chris Lenk Date: Thu, 18 Jun 2020 08:58:00 -0400 Subject: [PATCH] Move a couple tests for organization --- stix2/test/v20/test_custom.py | 24 ++++++++++++------------ stix2/test/v21/test_custom.py | 24 ++++++++++++------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/stix2/test/v20/test_custom.py b/stix2/test/v20/test_custom.py index 57f8aac..33be3e2 100644 --- a/stix2/test/v20/test_custom.py +++ b/stix2/test/v20/test_custom.py @@ -288,6 +288,18 @@ def test_custom_marking_no_init_2(): assert no2.property1 == 'something' +def test_register_duplicate_marking(): + with pytest.raises(DuplicateRegistrationError) as excinfo: + @stix2.v20.CustomMarking( + 'x-new-obj2', [ + ('property1', stix2.properties.StringProperty(required=True)), + ], + ) + class NewObj2(): + pass + assert "cannot be registered again" in str(excinfo.value) + + @stix2.v20.CustomObject( 'x-new-type', [ ('property1', stix2.properties.StringProperty(required=True)), @@ -1119,15 +1131,3 @@ def test_register_duplicate_observable_extension(): class NewExtension2(): pass assert "cannot be registered again" in str(excinfo.value) - - -def test_register_duplicate_marking(): - with pytest.raises(DuplicateRegistrationError) as excinfo: - @stix2.v20.CustomMarking( - 'x-new-obj-2', [ - ('property1', stix2.properties.StringProperty(required=True)), - ], - ) - class NewObj2(): - pass - assert "cannot be registered again" in str(excinfo.value) diff --git a/stix2/test/v21/test_custom.py b/stix2/test/v21/test_custom.py index 3646f11..146abcd 100644 --- a/stix2/test/v21/test_custom.py +++ b/stix2/test/v21/test_custom.py @@ -397,6 +397,18 @@ def test_custom_marking_invalid_type_name(): pass # pragma: no cover assert "Invalid type name '7x-new-marking':" in str(excinfo.value) + +def test_register_duplicate_marking(): + with pytest.raises(DuplicateRegistrationError) as excinfo: + @stix2.v21.CustomMarking( + 'x-new-obj', [ + ('property1', stix2.properties.StringProperty(required=True)), + ], + ) + class NewObj2(): + pass + assert "cannot be registered again" in str(excinfo.value) + # Custom Objects @@ -1326,15 +1338,3 @@ def test_register_duplicate_observable_extension(): class NewExtension2(): pass assert "cannot be registered again" in str(excinfo.value) - - -def test_register_duplicate_marking(): - with pytest.raises(DuplicateRegistrationError) as excinfo: - @stix2.v21.CustomMarking( - 'x-new-obj', [ - ('property1', stix2.properties.StringProperty(required=True)), - ], - ) - class NewObj2(): - pass - assert "cannot be registered again" in str(excinfo.value)