allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [1/2] git commit: [#7351] Added test for export_controlled audit log fix
Date Wed, 28 May 2014 01:51:10 GMT
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 <johnsca@gmail.com>
Authored: Tue May 27 21:50:14 2014 -0400
Committer: Cory Johns <johnsca@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',


Mime
View raw message