allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [09/27] git commit: [#7657] ticket:649 Add simple test
Date Mon, 29 Sep 2014 16:17:40 GMT
[#7657] ticket:649 Add simple test


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

Branch: refs/heads/db/7657
Commit: 75143b1458f106ea5f485d201eb1bdee15919a9c
Parents: 143ce80
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Fri Sep 12 12:37:56 2014 +0300
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Fri Sep 26 16:39:44 2014 +0000

----------------------------------------------------------------------
 .../allura/tests/functional/test_site_admin.py  | 35 ++++++++++++++++++++
 1 file changed, 35 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/75143b14/Allura/allura/tests/functional/test_site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_site_admin.py b/Allura/allura/tests/functional/test_site_admin.py
index 5b0a9b0..8b8e55f 100644
--- a/Allura/allura/tests/functional/test_site_admin.py
+++ b/Allura/allura/tests/functional/test_site_admin.py
@@ -17,6 +17,7 @@
 #       under the License.
 
 import json
+import datetime as dt
 
 from mock import patch, MagicMock
 from nose.tools import assert_equal, assert_in, assert_not_in
@@ -319,6 +320,40 @@ class TestUsersSearch(TestController):
                            'Disabled?', 'url', 'Details'])
 
 
+class TestUserDetails(TestController):
+
+    def test_404(self):
+        self.app.get('/nf/admin/user/does-not-exist/', status=404)
+
+    def test_general_info(self):
+        user = M.User.by_username('test-admin')
+        user.registration_date = lambda: dt.datetime(2014, 9, 1, 9, 9, 9)
+        user.last_access = {'login_date': dt.datetime(2014, 9, 2, 6, 6, 6),
+                            'login_ua': 'browser of the future 1.0',
+                            'login_ip': '8.8.8.8',
+                            'session_date': dt.datetime(2014, 9, 12, 6, 6, 6),
+                            'session_ua': 'browser of the future 1.1',
+                            'session_ip': '7.7.7.7'}
+        r = self.app.get('/nf/admin/user/test-admin/')
+        # general info
+        assert_in('Username: test-admin', r)
+        assert_in('Full name: Test Admin', r)
+        assert_in('Registered: 2014-09-01 09:09:09', r)
+        # session info
+        assert_in('Date: 2014-09-02 06:06:06', r)
+        assert_in('IP: 8.8.8.8', r)
+        assert_in('UA: browser of the future 1.0', r)
+        assert_in('Date: 2014-09-12 06:06:06', r)
+        assert_in('IP: 7.7.7.7', r)
+        assert_in('UA: browser of the future 1.1', r)
+        # list of projects
+        projects = r.html.findAll('fieldset')[-1]
+        projects = [e.getText() for e in projects.findAll('li')]
+        assert_in('Test 2', projects)
+        assert_in('Test Project', projects)
+        assert_in('Adobe project 1', projects)
+
+
 @task
 def test_task(*args, **kw):
     """test_task doc string"""


Mime
View raw message