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/18 09:29:49 UTC

[14/43] 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/ef66cbbd
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/ef66cbbd
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/ef66cbbd

Branch: refs/heads/je/42cc_7656
Commit: ef66cbbddcc93adfb0f91b7bb90fee78630a8807
Parents: a39bce7
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Sep 12 10:16:10 2014 +0300
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Sep 16 15:33:36 2014 +0000

----------------------------------------------------------------------
 .../forgewiki/tests/functional/test_root.py     | 24 ++++++++++++++++++++
 1 file changed, 24 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/ef66cbbd/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