allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [05/27] git commit: [#7657] ticket:650 Fix tests
Date Mon, 29 Sep 2014 16:17:36 GMT
[#7657] ticket:650 Fix tests


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

Branch: refs/heads/db/7657
Commit: dfbf4f7bf9986572c4cd4dd5cd87d7d40370b362
Parents: 65f055f
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Fri Sep 12 15:17:59 2014 +0300
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Fri Sep 26 16:39:44 2014 +0000

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


http://git-wip-us.apache.org/repos/asf/allura/blob/dfbf4f7b/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 8b8e55f..5ad00af 100644
--- a/Allura/allura/tests/functional/test_site_admin.py
+++ b/Allura/allura/tests/functional/test_site_admin.py
@@ -353,6 +353,40 @@ class TestUserDetails(TestController):
         assert_in('Test Project', projects)
         assert_in('Adobe project 1', projects)
 
+    @patch('allura.model.auth.request')
+    def test_audit_log(self, request):
+        request.url = 'http://host.domain/path/'
+        c.user = M.User.by_username('test-user-1')
+        h.auditlog_user('test activity user 1')
+        h.auditlog_user('test activity user 2', user=M.User.by_username('test-user-2'))
+        r = self.app.get('/nf/admin/user/test-admin')
+        assert_in('Add comment', r)
+        assert_not_in('test activity', r)
+        r = self.app.get('/nf/admin/user/test-user-1')
+        assert_in('test activity user 1', r)
+        assert_not_in('test activity user 2', r)
+        r = self.app.get('/nf/admin/user/test-user-2')
+        assert_not_in('test activity user 1', r)
+        assert_in('test activity user 2', r)
+
+    def test_add_audit_trail_entry_access(self):
+        self.app.get('/nf/admin/user/add_audit_log_entry', status=404)  # GET is not allowed
+        r = self.app.post('/nf/admin/user/add_audit_log_entry',
+                          extra_environ={'username': '*anonymous'},
+                          status=302)
+        assert_equal(r.location, 'http://localhost/auth/')
+
+    def test_add_comment(self):
+        r = self.app.get('/nf/admin/user/test-user')
+        assert_not_in(u'Comment by test-admin: I was hêre!', r)
+        form = r.forms[0]
+        assert_equal(form['username'].value, 'test-user')
+        form['comment'] = u'I was hêre!'
+        r = form.submit()
+        assert_in(u'Comment added', self.webflash(r))
+        r = self.app.get('/nf/admin/user/test-user')
+        assert_in(u'Comment by test-admin: I was hêre!', r)
+
 
 @task
 def test_task(*args, **kw):


Mime
View raw message