incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [02/12] git commit: [#2502] ticket:300 Test summary emails for bulk edit
Date Mon, 22 Apr 2013 19:41:18 GMT
[#2502] ticket:300 Test summary emails for bulk edit


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/02b97b55
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/02b97b55
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/02b97b55

Branch: refs/heads/master
Commit: 02b97b552eddb1fee3ea5900fd85468bccb37f94
Parents: 4ac36f9
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Thu Apr 11 10:07:51 2013 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Mon Apr 22 19:40:26 2013 +0000

----------------------------------------------------------------------
 .../forgetracker/tests/functional/test_root.py     |   52 +++++++++++++++
 1 files changed, 52 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/02b97b55/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index bd6744c..3d1f14c 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -1089,6 +1089,58 @@ class TestFunctionalController(TrackerTestController):
         assert_in('test second ticket', str(ticket_rows))
         assert_false('test third ticket' in str(ticket_rows))
 
+    def test_bulk_edit_notifications(self):
+        self.new_ticket(summary='test first ticket', status='open')
+        self.new_ticket(summary='test second ticket', status='open')
+        self.new_ticket(summary='test third ticket', status='open')
+        ThreadLocalORMSession.flush_all()
+        M.MonQTask.run_ready()
+        ThreadLocalORMSession.flush_all()
+        first_ticket = tm.Ticket.query.get(summary='test first ticket')
+        second_ticket = tm.Ticket.query.get(summary='test second ticket')
+        third_ticket = tm.Ticket.query.get(summary='test third ticket')
+        first_user = M.User.by_username('test-user-0')
+        second_user = M.User.by_username('test-user-1')
+        admin = M.User.by_username('test-admin')
+        first_ticket.subscribe(user=first_user)
+        second_ticket.subscribe(user=second_user)
+        M.MonQTask.query.remove()
+        self.app.post('/p/test/bugs/update_tickets', {
+                      '__search': '',
+                      '__ticket_ids': (
+                          first_ticket._id,
+                          second_ticket._id,
+                          third_ticket._id),
+                      'status': 'accepted'})
+        M.MonQTask.run_ready()
+
+        emails = M.MonQTask.query.find(dict(task_name='allura.tasks.mail_tasks.sendmail')).all()
+        assert_equal(len(emails), 3)
+        for email in emails:
+            assert_equal(email.kwargs.subject, '[test:bugs] Bulk edit report')
+            assert_in('- **Status**: open --> accepted\n', email.kwargs.text)
+        first_user_email = M.MonQTask.query.find({
+            'task_name': 'allura.tasks.mail_tasks.sendmail',
+            'kwargs.destinations': first_user._id
+        }).all()
+        assert_equal(len(first_user_email), 1)
+        first_user_email = first_user_email[0]
+        second_user_email = M.MonQTask.query.find({
+            'task_name': 'allura.tasks.mail_tasks.sendmail',
+            'kwargs.destinations': second_user._id
+        }).all()
+        assert_equal(len(second_user_email), 1)
+        second_user_email = second_user_email[0]
+        admin_email = M.MonQTask.query.find({
+            'task_name': 'allura.tasks.mail_tasks.sendmail',
+            'kwargs.destinations': admin._id
+        }).all()
+        assert_equal(len(admin_email), 1)
+        admin_email = admin_email[0]
+
+        # TODO: check email text for first, second and admin users
+        #assert_in('### Affected tickets\n\n- [bugs:#1] test first ticket', first_user_email.kwargs.text)
+
     def test_vote(self):
         r = self.new_ticket(summary='test vote').follow()
         assert_false(r.html.find('div', {'id': 'vote'}))


Mime
View raw message