incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [1/6] git commit: [#6541] Added AuditLog on GC tracker import
Date Fri, 06 Sep 2013 15:11:41 GMT
Updated Branches:
  refs/heads/db/6541 [created] 78283fa60


[#6541] Added AuditLog on GC tracker import

Signed-off-by: Cory Johns <cjohns@slashdotmedia.com>


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

Branch: refs/heads/db/6541
Commit: 230c205bd94df4a5ad47abd3de9f5e3d6418e790
Parents: 99fa41f
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Wed Aug 28 19:38:10 2013 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Fri Sep 6 15:11:05 2013 +0000

----------------------------------------------------------------------
 ForgeImporters/forgeimporters/google/tracker.py        | 12 +++++++++---
 .../tests/google/functional/test_tracker.py            |  1 +
 .../forgeimporters/tests/google/test_tracker.py        | 13 ++++++++-----
 3 files changed, 18 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/230c205b/ForgeImporters/forgeimporters/google/tracker.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/tracker.py b/ForgeImporters/forgeimporters/google/tracker.py
index 58f28d2..cf6067e 100644
--- a/ForgeImporters/forgeimporters/google/tracker.py
+++ b/ForgeImporters/forgeimporters/google/tracker.py
@@ -24,9 +24,6 @@ from pylons import tmpl_context as c
 from pylons import app_globals as g
 from ming.orm import session, ThreadLocalORMSession
 
-from allura import model as M
-#import gdata
-gdata = None
 from tg import (
         expose,
         flash,
@@ -42,6 +39,7 @@ from allura.controllers import BaseController
 from allura.lib import helpers as h
 from allura.lib.plugin import ImportIdConverter
 from allura.lib.decorators import require_post, task
+from allura import model as M
 
 from forgetracker.tracker_main import ForgeTrackerApp
 from forgetracker import model as TM
@@ -142,6 +140,14 @@ class GoogleCodeTrackerImporter(ToolImporter):
                 app.globals.custom_fields = self.postprocess_custom_fields()
                 app.globals.last_ticket_num = self.max_ticket_num
                 ThreadLocalORMSession.flush_all()
+            M.AuditLog.log(
+                    'import tool %s from %s on %s' % (
+                            app.config.options.mount_point,
+                            project_name, self.source,
+                        ),
+                    project=project,
+                    user=user,
+                )
             g.post_event('project_updated')
             app.globals.invalidate_bin_counts()
             return app

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/230c205b/ForgeImporters/forgeimporters/tests/google/functional/test_tracker.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/google/functional/test_tracker.py b/ForgeImporters/forgeimporters/tests/google/functional/test_tracker.py
index 7f504a5..9f48257 100644
--- a/ForgeImporters/forgeimporters/tests/google/functional/test_tracker.py
+++ b/ForgeImporters/forgeimporters/tests/google/functional/test_tracker.py
@@ -50,6 +50,7 @@ class TestGCTrackerImporter(TestCase):
         self.assertIsNone(self.project.app_instance('test-issue'))
         with mock.patch.object(base.h, 'urlopen') as urlopen,\
              mock.patch.object(google.tracker, 'GoogleCodeProjectExtractor') as GPE,\
+             mock.patch.object(google.tracker.M, 'AuditLog') as AL,\
              mock.patch('forgetracker.tasks.update_bin_counts') as ubc:
             urlopen.side_effect = lambda req, **kw: mock.Mock(read=req.get_full_url, info=lambda:{'content-type':
'text/plain'})
             GPE.iter_issues.return_value = [(issue_id, issue)]

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/230c205b/ForgeImporters/forgeimporters/tests/google/test_tracker.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/google/test_tracker.py b/ForgeImporters/forgeimporters/tests/google/test_tracker.py
index 05b33ae..8f434df 100644
--- a/ForgeImporters/forgeimporters/tests/google/test_tracker.py
+++ b/ForgeImporters/forgeimporters/tests/google/test_tracker.py
@@ -42,12 +42,12 @@ class TestTrackerImporter(TestCase):
         importer.postprocess_custom_fields = mock.Mock()
         project, user = mock.Mock(), mock.Mock()
         app = project.install_app.return_value
-        app.config.options = {
-                'import_id': {
-                        'source': 'Google Code',
-                        'project_name': 'project_name',
-                    },
+        app.config.options.mount_point = 'mount_point'
+        app.config.options.import_id = {
+                'source': 'Google Code',
+                'project_name': 'project_name',
             }
+        app.config.options.get = lambda *a: getattr(app.config.options, *a)
         issues = gpe.iter_issues.return_value = [(50, mock.Mock()), (100, mock.Mock())]
         tickets = TM.Ticket.side_effect = [mock.Mock(), mock.Mock()]
 
@@ -89,6 +89,9 @@ class TestTrackerImporter(TestCase):
                 mock.call(tickets[1]),
             ])
         self.assertEqual(app.globals.last_ticket_num, 100)
+        M.AuditLog.log.assert_called_once_with(
+                'import tool mount_point from project_name on Google Code',
+                project=project, user=user)
         g.post_event.assert_called_once_with('project_updated')
         app.globals.invalidate_bin_counts.assert_called_once_with()
 


Mime
View raw message