You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by he...@apache.org on 2016/01/27 21:22:33 UTC

[19/50] allura git commit: Return 404 instead of error, if accessing unavailable import_project url

Return 404 instead of error, if accessing unavailable import_project url


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

Branch: refs/heads/hs/8035
Commit: c5b6ce55f5aaf86bb7f5e926c0ff4ab2986f3ea1
Parents: 14ccf22
Author: Dave Brondsema <da...@brondsema.net>
Authored: Tue Jan 26 13:42:15 2016 -0500
Committer: Heith Seewald <he...@gmail.com>
Committed: Wed Jan 27 13:39:49 2016 -0500

----------------------------------------------------------------------
 Allura/allura/controllers/project.py                | 3 +++
 Allura/allura/tests/functional/test_neighborhood.py | 8 ++++++++
 2 files changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/c5b6ce55/Allura/allura/controllers/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/project.py b/Allura/allura/controllers/project.py
index 1742372..6e02609 100644
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -1006,5 +1006,8 @@ class ProjectImporterController(object):
 
     @expose()
     def _lookup(self, source, *rest):
+        # iter_entry_points is a generator with 0 or 1 items, so a loop is the easiest way to handle
         for ep in iter_entry_points('allura.project_importers', source):
             return ep.load()(self.neighborhood), rest
+
+        raise exc.HTTPNotFound

http://git-wip-us.apache.org/repos/asf/allura/blob/c5b6ce55/Allura/allura/tests/functional/test_neighborhood.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_neighborhood.py b/Allura/allura/tests/functional/test_neighborhood.py
index b97a7c8..a7609df 100644
--- a/Allura/allura/tests/functional/test_neighborhood.py
+++ b/Allura/allura/tests/functional/test_neighborhood.py
@@ -1087,3 +1087,11 @@ class TestPhoneVerificationOnProjectRegistration(TestController):
             iframe = overlay.find('iframe')
             assert_equal(header.getText(), 'Phone Verification Required')
             assert_equal(iframe.get('src'), '/p/phone_verification_fragment')
+
+
+class TestProjectImport(TestController):
+
+    def test_not_found(self):
+        self.app.get('/p/import_project/asdf/', status=404)
+
+    # positive tests exist within ForgeImporter package