You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2013/04/23 18:42:37 UTC
[33/50] [abbrv] git commit: [#2502] ticket:300 Expand test with
checks for email content
[#2502] ticket:300 Expand test with checks for email content
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/bc4fc9f3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/bc4fc9f3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/bc4fc9f3
Branch: refs/heads/cj/5120
Commit: bc4fc9f3aa861d34ed607907175da007a88cb386
Parents: 02b97b5
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Apr 12 09:24:43 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Mon Apr 22 19:40:26 2013 +0000
----------------------------------------------------------------------
.../forgetracker/tests/functional/test_root.py | 40 ++++++++++++---
1 files changed, 32 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/bc4fc9f3/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 3d1f14c..b5d87a0 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -1090,9 +1090,9 @@ class TestFunctionalController(TrackerTestController):
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')
+ self.new_ticket(summary='test first ticket', status='open', _milestone='2.0')
+ self.new_ticket(summary='test second ticket', status='accepted', _milestone='1.0')
+ self.new_ticket(summary='test third ticket', status='unread')
ThreadLocalORMSession.flush_all()
M.MonQTask.run_ready()
ThreadLocalORMSession.flush_all()
@@ -1111,14 +1111,14 @@ class TestFunctionalController(TrackerTestController):
first_ticket._id,
second_ticket._id,
third_ticket._id),
- 'status': 'accepted'})
+ 'status': 'accepted',
+ '_milestone': '2.0'})
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)
+ assert_equal(email.kwargs.subject, '[test:bugs] Mass edit changes')
first_user_email = M.MonQTask.query.find({
'task_name': 'allura.tasks.mail_tasks.sendmail',
'kwargs.destinations': first_user._id
@@ -1138,8 +1138,32 @@ class TestFunctionalController(TrackerTestController):
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)
+ # Expected data
+ email_header = '''Mass edit changing:
+- **status**: accepted
+- **Milestone: 2.0
+'''
+ first_ticket_changes = '''ticket: [bugs:#1]
+- **status**: open --> accepted
+- **Milestone: 2.0 --> 2.0
+'''
+ second_ticket_changes = '''ticket: [bugs:#2]
+- **status**: accepted --> accepted
+- **Milestone: 1.0 --> 2.0
+'''
+ third_ticket_changes = '''ticket: [bugs:#3]
+- **status**: unread --> accepted
+- **Milestone: --> 2.0
+'''
+ email = '\n'.join([email_header, first_ticket_changes])
+ assert_equal(email, first_user_email.kwargs.text)
+ email = '\n'.join([email_header, second_ticket_changes])
+ assert_equal(email, second_user_email.kwargs.text)
+ email = '\n'.join([email_header,
+ first_ticket_changes,
+ second_ticket_changes,
+ third_ticket_changes])
+ assert_equal(email, admin_email.kwargs.text)
def test_vote(self):
r = self.new_ticket(summary='test vote').follow()