incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [4/4] git commit: [#6541] Added import_id and AuditLog to GC repo importer
Date Wed, 28 Aug 2013 20:49:48 GMT
[#6541] Added import_id and AuditLog to GC repo importer

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/a8d387b5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/a8d387b5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/a8d387b5

Branch: refs/heads/cj/6541
Commit: a8d387b5d4db0d67749c0a13133e06af2a22447a
Parents: 581f197
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Wed Aug 28 20:42:33 2013 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Wed Aug 28 20:42:33 2013 +0000

----------------------------------------------------------------------
 ForgeImporters/forgeimporters/google/code.py      | 12 +++++++++++-
 .../forgeimporters/google/tests/test_code.py      | 18 ++++++++++++++----
 2 files changed, 25 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a8d387b5/ForgeImporters/forgeimporters/google/code.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/code.py b/ForgeImporters/forgeimporters/google/code.py
index 60a0158..70b4de9 100644
--- a/ForgeImporters/forgeimporters/google/code.py
+++ b/ForgeImporters/forgeimporters/google/code.py
@@ -36,6 +36,7 @@ from tg.decorators import (
 from allura.controllers import BaseController
 from allura.lib import validators as v
 from allura.lib.decorators import require_post, task
+from allura import model as M
 
 from forgeimporters.base import ToolImporter
 from forgeimporters.google import GoogleCodeProjectExtractor
@@ -163,6 +164,15 @@ class GoogleRepoImporter(ToolImporter):
                 mount_point=mount_point or 'code',
                 mount_label=mount_label or 'Code',
                 init_from_url=repo_url,
-                )
+                import_id={
+                        'source': self.source,
+                        'project_name': project_name,
+                    }
+            )
+        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')
         return app

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a8d387b5/ForgeImporters/forgeimporters/google/tests/test_code.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/tests/test_code.py b/ForgeImporters/forgeimporters/google/tests/test_code.py
index c6874ad..4028076 100644
--- a/ForgeImporters/forgeimporters/google/tests/test_code.py
+++ b/ForgeImporters/forgeimporters/google/tests/test_code.py
@@ -57,20 +57,30 @@ class TestGoogleRepoImporter(TestCase):
         return project
 
     @patch('forgeimporters.google.code.g')
+    @patch('forgeimporters.google.code.M')
     @patch('forgeimporters.google.code.GoogleCodeProjectExtractor')
     @patch('forgeimporters.google.code.get_repo_url')
-    def test_import_tool_happy_path(self, get_repo_url, gcpe, g):
+    def test_import_tool_happy_path(self, get_repo_url, gcpe, M, g):
         gcpe.return_value.get_repo_type.return_value = 'git'
         get_repo_url.return_value = 'http://remote/clone/url/'
         p = self._make_project(gc_proj_name='myproject')
-        GoogleRepoImporter().import_tool(p, Mock(name='c.user'),
-                project_name='project_name')
+        u = Mock(name='c.user')
+        app = p.install_app.return_value
+        app.config.options.mount_point = 'code'
+        GoogleRepoImporter().import_tool(p, u, project_name='project_name')
         get_repo_url.assert_called_once_with('project_name', 'git')
         p.install_app.assert_called_once_with('Git',
                 mount_point='code',
                 mount_label='Code',
                 init_from_url='http://remote/clone/url/',
-                )
+                import_id={
+                        'source': 'Google Code',
+                        'project_name': 'project_name',
+                    },
+            )
+        M.AuditLog.log.assert_called_once_with(
+                'import tool code from project_name on Google Code',
+                project=p, user=u)
         g.post_event.assert_called_once_with('project_updated')
 
 


Mime
View raw message