Skip to content

Commit

Permalink
Add tests for equal sysname
Browse files Browse the repository at this point in the history
  • Loading branch information
johannaengland committed Nov 20, 2023
1 parent 2802502 commit 124c3c9
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/integration/web/alertprofiles_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,32 @@ def test_alertprofiles_add_expression_with_equal_condition_should_succeed(
response.content
)

def test_alertprofiles_add_expression_with_equal_sysname_should_succeed(
self, client, dummy_filter
):
"""Tests that an expression with an equals condition for sysname can be
added
"""
group_match_field = MatchField.objects.get(name="Sysname")
url = reverse("alertprofiles-filters-saveexpression")
data = {
"filter": dummy_filter.pk,
"match_field": group_match_field.pk,
"operator": Operator.EQUALS,
"value": "abc",
}
response = client.post(url, data=data, follow=True)
assert response.status_code == 200
assert Expression.objects.filter(
filter=dummy_filter,
match_field=group_match_field,
operator=Operator.EQUALS,
value=data["value"],
).exists()
assert f"Added expression to filter {dummy_filter}" in smart_str(
response.content
)

def test_alertprofiles_add_expression_with_greater_condition_should_succeed(
self, client, dummy_filter
):
Expand Down

0 comments on commit 124c3c9

Please sign in to comment.