allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jetm...@apache.org
Subject [07/10] git commit: [#7593] ticket:627 Tests for adding audit trail entries
Date Tue, 19 Aug 2014 12:21:22 GMT
[#7593] ticket:627 Tests for adding audit trail entries


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

Branch: refs/heads/je/42cc_7593
Commit: 206fcd59977cd9ba340a5d3584b75909e12276b5
Parents: df926ba
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Thu Aug 7 15:03:47 2014 +0300
Committer: discort <lexad-al@bk.ru>
Committed: Tue Aug 19 12:15:06 2014 +0300

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


http://git-wip-us.apache.org/repos/asf/allura/blob/206fcd59/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 8dbc2f6..44c1b86 100644
--- a/Allura/allura/tests/functional/test_site_admin.py
+++ b/Allura/allura/tests/functional/test_site_admin.py
@@ -1,3 +1,4 @@
+# coding: utf-8
 #       Licensed to the Apache Software Foundation (ASF) under one
 #       or more contributor license agreements.  See the NOTICE file
 #       distributed with this work for additional information
@@ -179,6 +180,32 @@ class TestSiteAdmin(TestController):
         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/add_audit_log_entry', status=404)  # GET is not allowed
+        r = self.app.post('/nf/admin/add_audit_log_entry',
+                          extra_environ={'username': '*anonymous'},
+                          status=302)
+        assert_equal(r.location, 'http://localhost/auth/')
+
+    def test_add_comment_on_users_trail_page(self):
+        r = self.app.get('/nf/admin/users')
+        assert_not_in('Add comment', r)
+        r = self.app.get('/nf/admin/users?username=fake-user')
+        assert_not_in('Add comment', r)
+        r = self.app.get('/nf/admin/users?username=test-user')
+        assert_in('Add comment', r)
+
+    def test_add_comment(self):
+        r = self.app.get('/nf/admin/users?username=test-user')
+        assert_not_in(u'Comment by test-admin: I was hêre!', r)
+        form = r.forms[1]
+        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/users?username=test-user')
+        assert_in(u'Comment by test-admin: I was hêre!', r)
+
 
 @task
 def test_task(*args, **kw):


Mime
View raw message