Skip to content

Commit

Permalink
Fix the creation of the "My Events" tracking rule
Browse files Browse the repository at this point in the history
Fixes: #984
Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
  • Loading branch information
abompard committed Sep 11, 2023
1 parent 51005c6 commit c8b73fd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/984.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix the creation of the "My Events" tracking rule
2 changes: 1 addition & 1 deletion fmn/api/api_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ListParamTrackingRule(BaseModel):

class NoParamTrackingRule(BaseModel):
name: Literal["related-events"]
params: str | None
params: str | None = None


class ArtifactsFollowedTrackingRule(BaseModel):
Expand Down
18 changes: 18 additions & 0 deletions tests/api/handlers/test_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,3 +448,21 @@ async def test_create_user_rule_bad_email_dest(self, client, api_identity, db_ru
}
]
assert caplog.messages == [expected_message]

async def test_create_user_rule_related_events(self, client, api_identity, db_rule, caplog):
created_rule = {
"name": None,
"tracking_rule": {"name": "related-events"},
"generation_rules": [
{
"destinations": [{"protocol": "matrix", "address": "@dummy:example.com"}],
"filters": {},
},
],
}

response = client.post(f"{self.path}/{api_identity.name}/rules", json=created_rule)
assert response.status_code == status.HTTP_200_OK
rule = response.json()
assert rule["tracking_rule"]["name"] == "related-events"
assert rule["tracking_rule"]["params"] is None

0 comments on commit c8b73fd

Please sign in to comment.