Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
A follow-on patch will regenerate Make-managed files.

References:
* #549

Signed-off-by: Alex Nelson <[email protected]>
  • Loading branch information
ajnelson-nist committed Aug 13, 2024
1 parent a7c7814 commit f7a0f30
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ all: \
location_XFAIL_validation.ttl \
message_thread_PASS_validation.ttl \
message_thread_XFAIL_validation.ttl \
object_status_PASS_validation.ttl \
object_status_XFAIL_validation.ttl \
observable_creation_time_PASS_validation.ttl \
owl_axiom_PASS_validation.ttl \
owl_axiom_XFAIL_validation.ttl \
Expand Down Expand Up @@ -116,6 +118,8 @@ check: \
location_XFAIL_validation.ttl \
message_thread_PASS_validation.ttl \
message_thread_XFAIL_validation.ttl \
object_status_PASS_validation.ttl \
object_status_XFAIL_validation.ttl \
observable_creation_time_PASS_validation.ttl \
owl_axiom_PASS_validation.ttl \
owl_axiom_XFAIL_validation.ttl \
Expand Down
16 changes: 16 additions & 0 deletions tests/examples/object_status_PASS.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"@context": {
"core": "https://ontology.unifiedcyberontology.org/uco/core/",
"kb": "http://example.org/kb/"
},
"@graph": [
{
"@id": "kb:UcoObject-f86c567d-374a-4873-b9bc-a746ca2bf360",
"@type": "core:UcoObject",
"core:objectStatus": {
"@type": "core:ObjectStatusVocab",
"@value": "Draft"
}
}
]
}
15 changes: 15 additions & 0 deletions tests/examples/object_status_XFAIL.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"@context": {
"core": "https://ontology.unifiedcyberontology.org/uco/core/",
"kb": "http://example.org/kb/",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#"
},
"@graph": [
{
"@id": "kb:UcoObject-6ae2b245-a8cd-45dc-9f40-5b2738879351",
"@type": "core:UcoObject",
"rdfs:comment": "This will trigger an error from using a value outside of the required vocabulary.",
"core:objectStatus": "Initial draft"
}
]
}
18 changes: 18 additions & 0 deletions tests/examples/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,24 @@ def test_message_thread_PASS_validation() -> None:
def test_message_thread_XFAIL_validation() -> None:
confirm_validation_results("message_thread_XFAIL_validation.ttl", False)

def test_object_status_PASS() -> None:
confirm_validation_results(
"object_status_PASS_validation.ttl",
True,
)

def test_object_status_XFAIL() -> None:
confirm_validation_results(
"object_status_XFAIL_validation.ttl",
False,
expected_focus_node_severities={
(
"http://example.org/kb/UcoObject-6ae2b245-a8cd-45dc-9f40-5b2738879351",
str(NS_SH.Violation)
),
}
)

def test_observable_creation_time_PASS() -> None:
confirm_validation_results(
"observable_creation_time_PASS_validation.ttl",
Expand Down

0 comments on commit f7a0f30

Please sign in to comment.