Fix import issues
parent
f37b84a564
commit
b06bc1afc1
|
@ -8,7 +8,7 @@ import re
|
||||||
import stix2
|
import stix2
|
||||||
|
|
||||||
from .base import _Observable, _STIXBase
|
from .base import _Observable, _STIXBase
|
||||||
from .exceptions import ParseError
|
from .exceptions import DuplicateObjectRegistrationError, ParseError
|
||||||
from .markings import _MarkingsMixin
|
from .markings import _MarkingsMixin
|
||||||
from .utils import SCO21_EXT_REGEX, TYPE_REGEX, _get_dict
|
from .utils import SCO21_EXT_REGEX, TYPE_REGEX, _get_dict
|
||||||
|
|
||||||
|
|
|
@ -233,3 +233,10 @@ class STIXDeprecationWarning(DeprecationWarning):
|
||||||
Represents usage of a deprecated component of a STIX specification.
|
Represents usage of a deprecated component of a STIX specification.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class DuplicateObjectRegistrationError(STIXError):
|
||||||
|
"""An object (or observable) with the same type as an existing object (or observable) is being registered"""
|
||||||
|
|
||||||
|
def __init__(self, msg):
|
||||||
|
super(DuplicateObjectRegistrationError, self).__init__(msg)
|
||||||
|
|
|
@ -4,7 +4,7 @@ import stix2
|
||||||
from stix2 import core
|
from stix2 import core
|
||||||
import stix2.v20
|
import stix2.v20
|
||||||
|
|
||||||
from ...exceptions import InvalidValueError
|
from ...exceptions import DuplicateObjectRegistrationError, InvalidValueError
|
||||||
from .constants import FAKE_TIME, IDENTITY_ID, MARKING_DEFINITION_ID
|
from .constants import FAKE_TIME, IDENTITY_ID, MARKING_DEFINITION_ID
|
||||||
|
|
||||||
IDENTITY_CUSTOM_PROP = stix2.v20.Identity(
|
IDENTITY_CUSTOM_PROP = stix2.v20.Identity(
|
||||||
|
@ -1040,7 +1040,7 @@ def test_register_custom_object_with_version():
|
||||||
|
|
||||||
|
|
||||||
def test_register_duplicate_object_with_version():
|
def test_register_duplicate_object_with_version():
|
||||||
with pytest.raises(stix2.exceptions.DuplicateObjectRegistrationError) as excinfo:
|
with pytest.raises(DuplicateObjectRegistrationError) as excinfo:
|
||||||
@stix2.v20.CustomObject(
|
@stix2.v20.CustomObject(
|
||||||
'x-new-type-2', [
|
'x-new-type-2', [
|
||||||
('property1', stix2.properties.StringProperty()),
|
('property1', stix2.properties.StringProperty()),
|
||||||
|
@ -1069,7 +1069,7 @@ def test_register_observable_with_version():
|
||||||
|
|
||||||
|
|
||||||
def test_register_duplicate_observable_with_version():
|
def test_register_duplicate_observable_with_version():
|
||||||
with pytest.raises(stix2.exceptions.DuplicateObjectRegistrationError) as excinfo:
|
with pytest.raises(DuplicateObjectRegistrationError) as excinfo:
|
||||||
@stix2.v20.CustomObservable(
|
@stix2.v20.CustomObservable(
|
||||||
'x-new-observable-2', [
|
'x-new-observable-2', [
|
||||||
('property1', stix2.properties.StringProperty()),
|
('property1', stix2.properties.StringProperty()),
|
||||||
|
|
|
@ -6,7 +6,7 @@ import stix2
|
||||||
import stix2.base
|
import stix2.base
|
||||||
import stix2.v21
|
import stix2.v21
|
||||||
|
|
||||||
from ...exceptions import InvalidValueError
|
from ...exceptions import DuplicateObjectRegistrationError, InvalidValueError
|
||||||
from .constants import FAKE_TIME, IDENTITY_ID, MARKING_DEFINITION_ID
|
from .constants import FAKE_TIME, IDENTITY_ID, MARKING_DEFINITION_ID
|
||||||
|
|
||||||
IDENTITY_CUSTOM_PROP = stix2.v21.Identity(
|
IDENTITY_CUSTOM_PROP = stix2.v21.Identity(
|
||||||
|
@ -1092,7 +1092,7 @@ def test_register_custom_object_with_version():
|
||||||
|
|
||||||
|
|
||||||
def test_register_duplicate_object_with_version():
|
def test_register_duplicate_object_with_version():
|
||||||
with pytest.raises(stix2.exceptions.DuplicateObjectRegistrationError) as excinfo:
|
with pytest.raises(DuplicateObjectRegistrationError) as excinfo:
|
||||||
@stix2.v21.CustomObject(
|
@stix2.v21.CustomObject(
|
||||||
'x-new-type-2', [
|
'x-new-type-2', [
|
||||||
('property1', stix2.properties.StringProperty()),
|
('property1', stix2.properties.StringProperty()),
|
||||||
|
@ -1121,7 +1121,7 @@ def test_register_observable_with_version():
|
||||||
|
|
||||||
|
|
||||||
def test_register_duplicate_observable_with_version():
|
def test_register_duplicate_observable_with_version():
|
||||||
with pytest.raises(stix2.exceptions.DuplicateObjectRegistrationError) as excinfo:
|
with pytest.raises(DuplicateObjectRegistrationError) as excinfo:
|
||||||
@stix2.v21.CustomObservable(
|
@stix2.v21.CustomObservable(
|
||||||
'x-new-observable-2', [
|
'x-new-observable-2', [
|
||||||
('property1', stix2.properties.StringProperty()),
|
('property1', stix2.properties.StringProperty()),
|
||||||
|
|
Loading…
Reference in New Issue