incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [3/3] git commit: [#6456] Add project_update event to GC project and code importer
Date Wed, 31 Jul 2013 18:45:13 GMT
[#6456] Add project_update event to GC project and code 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/158cd46b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/158cd46b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/158cd46b

Branch: refs/heads/master
Commit: 158cd46bcd01c271baa11569361583c0408b56cd
Parents: 227396f
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Thu Jul 25 15:10:42 2013 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Wed Jul 31 18:44:35 2013 +0000

----------------------------------------------------------------------
 ForgeImporters/forgeimporters/google/code.py     |  5 ++++-
 ForgeImporters/forgeimporters/google/tasks.py    |  2 ++
 ForgeImporters/forgeimporters/tests/test_base.py | 11 -----------
 3 files changed, 6 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/158cd46b/ForgeImporters/forgeimporters/google/code.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/code.py b/ForgeImporters/forgeimporters/google/code.py
index 1ce51de..8e047fb 100644
--- a/ForgeImporters/forgeimporters/google/code.py
+++ b/ForgeImporters/forgeimporters/google/code.py
@@ -19,6 +19,7 @@ import formencode as fe
 from formencode import validators as fev
 
 from pylons import tmpl_context as c
+from pylons import app_globals as g
 from tg import (
         expose,
         redirect,
@@ -111,9 +112,11 @@ class GoogleRepoImporter(ToolImporter):
         repo_type = extractor.get_repo_type()
         repo_url = get_repo_url(project.get_tool_data('google-code',
             'project_name'), repo_type)
-        return project.install_app(
+        app = project.install_app(
                 REPO_ENTRY_POINTS[repo_type],
                 mount_point=mount_point or 'code',
                 mount_label=mount_label or 'Code',
                 init_from_url=repo_url,
                 )
+        g.post_event('project_updated')
+        return app

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/158cd46b/ForgeImporters/forgeimporters/google/tasks.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/tasks.py b/ForgeImporters/forgeimporters/google/tasks.py
index 834dc9d..65dd126 100644
--- a/ForgeImporters/forgeimporters/google/tasks.py
+++ b/ForgeImporters/forgeimporters/google/tasks.py
@@ -16,6 +16,7 @@
 #       under the License.
 
 from pylons import tmpl_context as c
+from pylons import app_globals as g
 
 from ming.orm import ThreadLocalORMSession
 
@@ -32,6 +33,7 @@ def import_project_info():
     extractor.get_icon()
     extractor.get_license()
     ThreadLocalORMSession.flush_all()
+    g.post_event('project_updated')
 
 @task
 def import_tool(importer_name, mount_point=None, mount_label=None):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/158cd46b/ForgeImporters/forgeimporters/tests/test_base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/test_base.py b/ForgeImporters/forgeimporters/tests/test_base.py
index 303570d..1558db4 100644
--- a/ForgeImporters/forgeimporters/tests/test_base.py
+++ b/ForgeImporters/forgeimporters/tests/test_base.py
@@ -35,17 +35,6 @@ def ep(name, source=None, importer=None, **kw):
     return mep
 
 
-class TestProjectImporterDispatcher(TestCase):
-    @mock.patch.object(base, 'iter_entry_points')
-    def test_lookup(self, iep):
-        eps = iep.return_value = [ep('ep1', 'first'), ep('ep2', 'second')]
-        nbhd = mock.Mock(name='neighborhood')
-        result = base.ProjectImporterDispatcher(nbhd)._lookup('source', 'rest1', 'rest2')
-        self.assertEqual(result, (eps[0].lv, ('rest1', 'rest2')))
-        iep.assert_called_once_with('allura.project_importers', 'source')
-        eps[0].load.return_value.assert_called_once_with(nbhd)
-
-
 class TestProjectImporter(TestCase):
     @mock.patch.object(base, 'iter_entry_points')
     def test_tool_importers(self, iep):


Mime
View raw message