You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2014/09/12 12:29:42 UTC
[28/28] git commit: [#4905] ticket:655 Add test for wiki subscribe
[#4905] ticket:655 Add test for wiki subscribe
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/2602ee1e
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/2602ee1e
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/2602ee1e
Branch: refs/heads/je/42cc_4905
Commit: 2602ee1e7a2bcbc2210f066197328fda3fb60218
Parents: 4cd61a4
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Sep 12 10:16:10 2014 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Fri Sep 12 10:16:10 2014 +0300
----------------------------------------------------------------------
.../forgewiki/tests/functional/test_root.py | 24 ++++++++++++++++++++
1 file changed, 24 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/2602ee1e/ForgeWiki/forgewiki/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/tests/functional/test_root.py b/ForgeWiki/forgewiki/tests/functional/test_root.py
index 072be6a..0ad3cc2 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_root.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_root.py
@@ -745,3 +745,27 @@ class TestRootController(TestController):
def test_user_browse_page(self):
r = self.app.get('/wiki/browse_pages/')
assert '<td>Test Admin (test-admin)</td>' in r
+
+ def test_subscribe(self):
+ user = M.User.query.get(username='test-user')
+ # user is not subscribed
+ assert not M.Mailbox.subscribed(user_id=user._id)
+ r = self.app.get('/p/test/wiki/Home/', extra_environ={'username': str(user.username)})
+ link = r.html.find('a', {'href': '/p/test/wiki/subscribe?subscribe=True'})
+ assert link is not None
+ # subscribe
+ self.app.get('/p/test/wiki/subscribe?subscribe=True',
+ extra_environ={'username': str(user.username)}).follow()
+ # user is subscribed
+ assert M.Mailbox.subscribed(user_id=user._id)
+ r = self.app.get('/p/test/wiki/Home/', extra_environ={'username': str(user.username)})
+ link = r.html.find('a', {'href': '/p/test/wiki/subscribe?unsubscribe=True'})
+ assert link is not None
+ # unsubscribe
+ self.app.get('/p/test/wiki/subscribe?unsubscribe=True',
+ extra_environ={'username': str(user.username)}).follow()
+ # user is not subscribed
+ assert not M.Mailbox.subscribed(user_id=user._id)
+ r = self.app.get('/p/test/wiki/Home/', extra_environ={'username': str(user.username)})
+ link = r.html.find('a', {'href': '/p/test/wiki/subscribe?subscribe=True'})
+ assert link is not None