allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [4/5] git commit: [#4905] ticket:655 Add test for wiki subscribe
Date Tue, 16 Sep 2014 15:44:33 GMT
[#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/master
Commit: ef66cbbddcc93adfb0f91b7bb90fee78630a8807
Parents: a39bce7
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Fri Sep 12 10:16:10 2014 +0300
Committer: Dave Brondsema <dbrondsema@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


Mime
View raw message