You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2014/05/28 03:51:10 UTC
[1/2] git commit: [#7351] Added test for export_controlled audit log
fix
Repository: allura
Updated Branches:
refs/heads/master 31250bd1f -> db8da0fa4
[#7351] Added test for export_controlled audit log fix
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/db8da0fa
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/db8da0fa
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/db8da0fa
Branch: refs/heads/master
Commit: db8da0fa4697bbe9e67ccd946f37b33fa93f5cd0
Parents: 75faddb
Author: Cory Johns <jo...@gmail.com>
Authored: Tue May 27 21:50:14 2014 -0400
Committer: Cory Johns <jo...@gmail.com>
Committed: Tue May 27 21:50:19 2014 -0400
----------------------------------------------------------------------
Allura/allura/tests/functional/test_admin.py | 32 ++++++++++++++++++-----
1 file changed, 26 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/db8da0fa/Allura/allura/tests/functional/test_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_admin.py b/Allura/allura/tests/functional/test_admin.py
index fd77f6d..09edd47 100644
--- a/Allura/allura/tests/functional/test_admin.py
+++ b/Allura/allura/tests/functional/test_admin.py
@@ -46,21 +46,25 @@ from forgewiki.wiki_main import ForgeWikiApp
log = logging.getLogger(__name__)
+
@contextmanager
def audits(*messages):
M.AuditLog.query.remove()
yield
- entries = M.AuditLog.query.find().sort('_id').all()
- if not messages:
- for e in entries:
- print e.message
- import pdb
- pdb.set_trace()
for message in messages:
assert M.AuditLog.query.find(dict(
message=re.compile(message))).count(), 'Could not find "%s"' % message
+@contextmanager
+def out_audits(*messages):
+ M.AuditLog.query.remove()
+ yield
+ for message in messages:
+ assert not M.AuditLog.query.find(dict(
+ message=re.compile(message))).count(), 'Found unexpected: "%s"' % message
+
+
class TestProjectAdmin(TestController):
def get_available_tools(self):
@@ -174,6 +178,22 @@ class TestProjectAdmin(TestController):
r = self.app.get('/admin/audit/')
assert "uninstall tool test-tool" in r.body, r.body
+ def test_admin_export_control(self):
+ self.app.get('/admin/')
+ with audits('change project export controlled status to True'):
+ self.app.post('/admin/update', params=dict(
+ shortname='test',
+ export_controlled='True'))
+ with out_audits('change project export controlled status to True'):
+ self.app.post('/admin/update', params=dict(
+ shortname='test',
+ summary='TL;DR',
+ export_controlled='True'))
+ with audits('change project export controlled status to False'):
+ self.app.post('/admin/update', params=dict(
+ shortname='test',
+ export_controlled='False'))
+
@td.with_wiki
def test_block_user_empty_data(self):
r = self.app.post('/admin/wiki/block_user',
[2/2] git commit: [#7351] convert export_controlled to bool before
comparing to current value
Posted by jo...@apache.org.
[#7351] convert export_controlled to bool before comparing to current value
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/75faddba
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/75faddba
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/75faddba
Branch: refs/heads/master
Commit: 75faddbaeb0c5c08766e3235197a51fc8667ff0a
Parents: 31250bd
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue Apr 29 21:56:48 2014 +0000
Committer: Cory Johns <jo...@gmail.com>
Committed: Tue May 27 21:50:19 2014 -0400
----------------------------------------------------------------------
Allura/allura/ext/admin/admin_main.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/75faddba/Allura/allura/ext/admin/admin_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/admin_main.py b/Allura/allura/ext/admin/admin_main.py
index e889b29..07b27a5 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -445,12 +445,13 @@ class ProjectAdminController(BaseController):
h.log_action(log, 'change project moved to url').info('')
M.AuditLog.log('change project moved to url to %s', moved_to_url)
c.project.moved_to_url = moved_to_url
+ export_controlled = asbool(export_controlled)
if export_controlled != c.project.export_controlled:
h.log_action(
log, 'change project export controlled status').info('')
M.AuditLog.log(
'change project export controlled status to %s', export_controlled)
- c.project.export_controlled = not not export_controlled
+ c.project.export_controlled = export_controlled
if not export_controlled:
export_control_type = None
if export_control_type != c.project.export_control_type: