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/09/28 20:34:24 UTC

[2/2] allura git commit: [#7946] ticket:846 Add test for chat's configure

[#7946] ticket:846 Add test for chat's configure

It actually passes, cause turns out problem is in js, but can be still
useful in the future.


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

Branch: refs/heads/master
Commit: 367525f0eb942179dc7d728333a32fa5bde1564a
Parents: f3bd36c
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Sep 22 16:21:16 2015 +0300
Committer: Heith Seewald <hs...@hsmb.local>
Committed: Mon Sep 28 14:33:47 2015 -0400

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


http://git-wip-us.apache.org/repos/asf/allura/blob/367525f0/ForgeChat/forgechat/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeChat/forgechat/tests/functional/test_root.py b/ForgeChat/forgechat/tests/functional/test_root.py
index 013176c..49b824d 100644
--- a/ForgeChat/forgechat/tests/functional/test_root.py
+++ b/ForgeChat/forgechat/tests/functional/test_root.py
@@ -15,7 +15,16 @@
 #       specific language governing permissions and limitations
 #       under the License.
 
+import json
+from datadiff.tools import assert_equal
+
 from alluratest.controller import TestController
+from allura.tests.decorators import with_tool
+
+from forgechat import model as CM
+
+
+with_chat = with_tool('test', 'Chat', 'chat', 'Chat')
 
 
 class TestRootController(TestController):
@@ -23,3 +32,16 @@ class TestRootController(TestController):
     def test_root_index(self):
         response = self.app.get('/chat/').follow()
         assert 'Log for' in response
+
+    @with_chat
+    def test_admin_configure(self):
+        self.app.get('/')  # establish session
+        data = {'channel': 'test channel',
+                '_session_id': self.app.cookies['_session_id']}
+        ch = CM.ChatChannel.query.get()
+        assert_equal(ch.channel, '')
+        resp = self.app.post('/p/test/admin/chat/configure', data)
+        expected = {'status': 'ok', 'message': 'Chat options updated'}
+        assert_equal(json.loads(self.webflash(resp)), expected)
+        ch = CM.ChatChannel.query.get()
+        assert_equal(ch.channel, 'test channel')