You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2014/08/19 18:31:23 UTC
[3/6] git commit: [#7593] ticket:627 Tests for adding audit trail
entries
[#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/master
Commit: 206fcd59977cd9ba340a5d3584b75909e12276b5
Parents: df926ba
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu Aug 7 15:03:47 2014 +0300
Committer: discort <le...@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):