Skip to content

Commit

Permalink
Added quoting tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaspatzke committed Jul 31, 2022
1 parent d290f18 commit 15730e4
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion tests/test_backend_insight_idr.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,36 @@ def test_insight_idr_simple_eq_nocase_query(insight_idr_backend : InsightIDRBack
""")
) == ['field = NOCASE("foo")']

def test_insight_idr_single_quote(insight_idr_backend : InsightIDRBackend):
assert insight_idr_backend.convert(
SigmaCollection.from_yaml("""
title: Test
status: test
logsource:
category: process_creation
product: windows
detection:
selection:
field: fo"o
condition: selection
""")
) == ['field = NOCASE(\'fo"o\')']

def test_insight_idr_triple_quote(insight_idr_backend : InsightIDRBackend):
assert insight_idr_backend.convert(
SigmaCollection.from_yaml("""
title: Test
status: test
logsource:
category: process_creation
product: windows
detection:
selection:
field: fo'"o
condition: selection
""")
) == ['field = NOCASE("""fo\'"o""")']

def test_insight_idr_leql_advanced_search_output_format(insight_idr_backend : InsightIDRBackend):
assert insight_idr_backend.convert(
SigmaCollection.from_yaml("""
Expand Down Expand Up @@ -70,7 +100,7 @@ def test_insight_idr_not_condition_query(insight_idr_backend : InsightIDRBackend
selection:
field: foo
filter:
field: blah
field: blah
condition: selection and not filter
""")
) == ['field = NOCASE("foo") AND NOT field = NOCASE("blah")']
Expand Down

0 comments on commit 15730e4

Please sign in to comment.