Skip to content

Commit

Permalink
add python test for legacy merge
Browse files Browse the repository at this point in the history
  • Loading branch information
villebro committed Mar 9, 2021
1 parent 5d1771a commit c6c09a7
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions tests/utils_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -924,15 +924,38 @@ def test_merge_extra_filters_with_extras(self):
"time_range": "Last 10 days",
"extra_form_data": {
"append_form_data": {
"filters": [{"col": "foo", "op": "IN", "val": "bar"}]
"filters": [{"col": "foo", "op": "IN", "val": ["bar"]}],
"adhoc_filters": [
{
"expressionType": "SQL",
"clause": "WHERE",
"sqlExpression": "1 = 0",
}
],
},
"override_form_data": {"time_range": "Last 100 years",},
},
}
merge_extra_form_data(form_data)
assert form_data["applied_time_extras"] == {"__time_range": "Last 100 years"}
adhoc_filters = form_data["adhoc_filters"]
assert adhoc_filters[0] == {
"clause": "WHERE",
"expressionType": "SQL",
"isExtra": True,
"sqlExpression": "1 = 0",
}
converted_filter = adhoc_filters[1]
del converted_filter["filterOptionName"]
assert converted_filter == {
"clause": "WHERE",
"comparator": ["bar"],
"expressionType": "SIMPLE",
"isExtra": True,
"operator": "IN",
"subject": "foo",
}
assert form_data["time_range"] == "Last 100 years"
assert len(form_data["adhoc_filters"]) == 1

def test_ssl_certificate_parse(self):
parsed_certificate = parse_ssl_cert(ssl_certificate)
Expand Down

0 comments on commit c6c09a7

Please sign in to comment.