From 22e424de0867369917fd9afe49083bf8bb26aac9 Mon Sep 17 00:00:00 2001 From: Ghost-script Date: Thu, 23 Apr 2015 20:48:10 +0530 Subject: [PATCH] Added tests for "fmn.rule.update" Fixed Bug: https://github.com/fedora-infra/fedmsg_meta_fedora_infrastructure/issues/247 --- fedmsg_meta_fedora_infrastructure/fmn.py | 2 ++ .../tests/fmn.py | 29 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/fedmsg_meta_fedora_infrastructure/fmn.py b/fedmsg_meta_fedora_infrastructure/fmn.py index 9d3d7e7..fef70ed 100644 --- a/fedmsg_meta_fedora_infrastructure/fmn.py +++ b/fedmsg_meta_fedora_infrastructure/fmn.py @@ -42,6 +42,8 @@ def subtitle(self, msg, **config): if 'fmn.confirmation.update' in msg['topic']: tmpl = self._("the {changed} of one of {user}'s " "pending confirmations changed") + elif 'fmn.rule.update' in msg['topic']: + tmpl = self._("{user} updated the {changed} on a fmn {ctx} rule") elif 'fmn.filter.update' in msg['topic']: tmpl = self._("{user} updated the {changed} on a fmn {ctx} filter") elif 'fmn.preference.update' in msg['topic']: diff --git a/fedmsg_meta_fedora_infrastructure/tests/fmn.py b/fedmsg_meta_fedora_infrastructure/tests/fmn.py index dd1933c..60e999b 100644 --- a/fedmsg_meta_fedora_infrastructure/tests/fmn.py +++ b/fedmsg_meta_fedora_infrastructure/tests/fmn.py @@ -243,6 +243,35 @@ class TestConfirmationUpdateStatus(Base): } } +class TestRuleUpdate(Base): + """ Messages of this type are published whenever **a rule + is updated** in the `Fedora Notifications + `_ app. + """ + expected_title = "fmn.rule.update" + expected_subti = "raveit65 updated the filters on a fmn email rule" + expected_link = "https://apps.fedoraproject.org/notifications/" + expected_icon = "https://apps.fedoraproject.org/img/icons/fedmsg.png" + expected_secondary_icon = ( + "https://seccdn.libravatar.org/avatar/" + "15321e38b8a94a429e68a68a0f5029371b987c3aa7a0072326538b65ae54ec7e" + "?s=64&d=retro") + expected_packages = set([]) + expected_usernames = set(['raveit65']) + expected_objects = set(['raveit65/email/rule/filters']) + msg = { + "i": 1, + "timestamp": 1427936259.0, + "msg_id": "2015-ca011930-b7ba-4355-a75d-079ffbe88fd2", + "topic": "org.fedoraproject.prod.fmn.rule.update", + "source_version": "0.6.5", + "msg": { + "openid": "raveit65.id.fedoraproject.org", + "changed": "filters", + "context": "email" + } + } + add_doc(locals())