Skip to content

Commit

Permalink
Add more tests for expression validation
Browse files Browse the repository at this point in the history
  • Loading branch information
johannaengland committed Nov 17, 2023
1 parent 4af77bb commit f33204c
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/integration/web/alertprofiles_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,30 @@ def test_alertprofiles_add_expression_with_multiple_alert_types_should_succeed(
response.content
)

def test_alertprofiles_add_expression_with_valid_group_should_succeed(
self, client, dummy_filter
):
"""Tests that an expression with a valid group can be added"""
group_match_field = MatchField.objects.get(name="Group")
url = reverse("alertprofiles-filters-saveexpression")
data = {
"filter": dummy_filter.pk,
"match_field": group_match_field.pk,
"operator": Operator.EQUALS,
"value": "AD",
}
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
)


class TestsPermissions:
def test_set_accountgroup_permissions_should_not_crash(self, db, client):
Expand Down

0 comments on commit f33204c

Please sign in to comment.