incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [01/50] git commit: [#5655] Added test for site_stats EP discovery
Date Fri, 03 May 2013 21:57:31 GMT
Updated Branches:
  refs/heads/db/6007 d8c7c1866 -> b6914fbb6 (forced update)


[#5655] Added test for site_stats EP discovery

Signed-off-by: Cory Johns <cjohns@slashdotmedia.com>


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

Branch: refs/heads/db/6007
Commit: c40ddaf69d11d20955e78a1d2ba86c52861595a4
Parents: 7225f73
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Fri Apr 26 15:28:09 2013 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Fri Apr 26 15:33:52 2013 +0000

----------------------------------------------------------------------
 Allura/allura/tests/functional/test_rest.py |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c40ddaf6/Allura/allura/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_rest.py b/Allura/allura/tests/functional/test_rest.py
index 68f769f..a08e8f7 100644
--- a/Allura/allura/tests/functional/test_rest.py
+++ b/Allura/allura/tests/functional/test_rest.py
@@ -19,7 +19,10 @@
 
 from datetime import datetime, timedelta
 
+from pylons import app_globals as g
 from nose.tools import assert_equal
+import mock
+import json
 
 from allura.tests import decorators as td
 from alluratest.controller import TestRestApiBase
@@ -96,3 +99,21 @@ class TestRestHome(TestRestApiBase):
         self.app.get('/rest/p/test/wiki/Home/',
                      extra_environ={'username': 'test-user-0'},
                      status=401)
+
+    def test_index(self):
+        eps = {
+                'site_stats': {
+                    'foo_24hr': lambda: 42,
+                    'bar_24hr': lambda: 84,
+                    'qux_24hr': lambda: 0,
+                },
+            }
+        with mock.patch.dict(g.entry_points, eps):
+            response = self.app.get('/rest/')
+            assert_equal(response.json, {
+                'site_stats': {
+                        'foo_24hr': 42,
+                        'bar_24hr': 84,
+                        'qux_24hr': 0,
+                    },
+                })


Mime
View raw message