Skip to content

Commit

Permalink
Merge pull request #597 from ryantxu1/relational-data-sink-merge-test
Browse files Browse the repository at this point in the history
Fix styling
  • Loading branch information
rpiazza authored Apr 16, 2024
2 parents 502604f + b613add commit 1b34137
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
4 changes: 2 additions & 2 deletions stix2/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ def __init__(self, allowed, **kwargs):

def clean(self, value, allow_custom, strict=False):
cleaned_value, _ = super(OpenVocabProperty, self).clean(
value, allow_custom, strict
value, allow_custom, strict,
)

# Disabled: it was decided that enforcing this is too strict (might
Expand All @@ -755,7 +755,7 @@ def clean(self, value, allow_custom, strict=False):
#
if strict is True:
has_custom = cleaned_value not in self.allowed

if not allow_custom and has_custom:
raise CustomContentError(
"custom value in open vocab: '{}'".format(cleaned_value),
Expand Down
18 changes: 16 additions & 2 deletions stix2/test/v21/test_datastore_relational_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"postgresql://postgres:admin@localhost/postgres",
False,
None,
True
True,
)

# Artifacts
Expand Down Expand Up @@ -56,6 +56,7 @@ def test_encrypted_artifact():
continue
assert encrypted_artifact_dict[attrib] == read_obj[attrib]


# Autonomous System
as_dict = {
"type": "autonomous-system",
Expand All @@ -76,6 +77,7 @@ def test_autonomous_system():
for attrib in as_dict.keys():
assert as_dict[attrib] == read_obj[attrib]


# Directory
directory_dict = {
"type": "directory",
Expand Down Expand Up @@ -106,6 +108,7 @@ def test_directory():
continue
assert directory_dict[attrib] == read_obj[attrib]


# Domain Name
domain_name_dict = {
"type": "domain-name",
Expand All @@ -115,7 +118,7 @@ def test_directory():
}


def test_autonomous_system():
def test_domain_name():
store.sink.generate_stix_schema()
domain_name_obj = stix2.parse(domain_name_dict)
store.add(domain_name_obj)
Expand All @@ -124,6 +127,7 @@ def test_autonomous_system():
for attrib in domain_name_dict.keys():
assert domain_name_dict[attrib] == read_obj[attrib]


# Email Address
email_addr_dict = {
"type": "email-addr",
Expand All @@ -144,6 +148,7 @@ def test_email_addr():
for attrib in email_addr_dict.keys():
assert email_addr_dict[attrib] == read_obj[attrib]


# Email Message
email_msg_dict = {
"type": "email-message",
Expand Down Expand Up @@ -255,6 +260,7 @@ def test_multipart_email_msg():
continue
assert multipart_email_msg_dict[attrib] == read_obj[attrib]


# File
# errors when adding magic_number_hex to store, so ignoring for now
file_dict = {
Expand Down Expand Up @@ -294,6 +300,7 @@ def test_file():
continue
assert file_dict[attrib] == read_obj[attrib]


# ipv4 ipv6
ipv4_dict = {
"type": "ipv4-addr",
Expand Down Expand Up @@ -329,6 +336,7 @@ def test_ipv6():
for attrib in ipv6_dict.keys():
assert ipv6_dict[attrib] == read_obj[attrib]


# Mutex
mutex_dict = {
"type": "mutex",
Expand All @@ -347,6 +355,7 @@ def test_mutex():
for attrib in mutex_dict.keys():
assert mutex_dict[attrib] == read_obj[attrib]


# Network Traffic
# ipfix property results in a unconsumed value error with the store add
network_traffic_dict = {
Expand Down Expand Up @@ -392,6 +401,7 @@ def test_network_traffic():
continue
assert network_traffic_dict[attrib] == read_obj[attrib]


# Process
process_dict = {
"type": "process",
Expand Down Expand Up @@ -434,6 +444,7 @@ def test_process():
continue
assert process_dict[attrib] == read_obj[attrib]


# Software
software_dict = {
"type": "software",
Expand Down Expand Up @@ -481,6 +492,7 @@ def test_url():
for attrib in url_dict.keys():
assert url_dict[attrib] == read_obj[attrib]


# User Account
user_account_dict = {
"type": "user-account",
Expand Down Expand Up @@ -519,6 +531,7 @@ def test_user_account():
continue
assert user_account_dict[attrib] == read_obj[attrib]


# Windows Registry
windows_registry_dict = {
"type": "windows-registry-key",
Expand Down Expand Up @@ -559,6 +572,7 @@ def test_windows_registry():
continue
assert windows_registry_dict[attrib] == read_obj[attrib]


# x509 Certificate
basic_x509_certificate_dict = {
"type": "x509-certificate",
Expand Down

0 comments on commit 1b34137

Please sign in to comment.