You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by he...@apache.org on 2015/04/01 23:10:24 UTC

[07/45] allura git commit: [#7841] ticket:742 Added test for Page.authors

[#7841] ticket:742 Added test for Page.authors


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

Branch: refs/heads/hss/7072
Commit: da74cead74895c2420b47d092b7af629f97efe0f
Parents: e887dfb
Author: Aleksey 'LXj' Alekseyev <go...@gmail.com>
Authored: Wed Mar 18 16:02:05 2015 +0200
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Thu Mar 19 14:51:21 2015 -0400

----------------------------------------------------------------------
 ForgeWiki/forgewiki/tests/test_models.py | 35 +++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/da74cead/ForgeWiki/forgewiki/tests/test_models.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/tests/test_models.py b/ForgeWiki/forgewiki/tests/test_models.py
index 5c10e50..2ab2f00 100644
--- a/ForgeWiki/forgewiki/tests/test_models.py
+++ b/ForgeWiki/forgewiki/tests/test_models.py
@@ -15,9 +15,15 @@
 #       specific language governing permissions and limitations
 #       under the License.
 
+from pylons import tmpl_context as c
+from ming.orm import session
+
 from allura.tests import TestController
 from allura.tests import decorators as td
 from alluratest.controller import setup_global_objects
+from allura import model as M
+from allura.lib import helpers as h
+
 
 from forgewiki.model import Page
 
@@ -59,3 +65,32 @@ class TestPageSnapshots(TestController):
         page = Page.query.get(title='test-page')
         # 10 changes by each thread + initial upsert
         assert page.history().count() == 21, page.history().count()
+
+
+class TestPage(TestController):
+
+    @td.with_wiki
+    def test_authors(self):
+        user = M.User.by_username('test-user')
+        admin = M.User.by_username('test-admin')
+        with h.push_config(c, user=admin):
+            page = Page.upsert('test-admin')
+            page.text = 'admin'
+            page.commit()
+
+        with h.push_config(c, user=user):
+            page.text = 'user'
+            page.commit()
+
+        authors = page.authors()
+        assert len(authors) == 2
+        assert user in authors
+        assert admin in authors
+
+        user.disabled = True
+        session(user).flush(user)
+
+        authors = page.authors()
+        assert len(authors) == 1
+        assert user not in authors
+        assert admin in authors