allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hei...@apache.org
Subject allura git commit: Return 404 instead of error, if accessing unavailable import_project url
Date Wed, 27 Jan 2016 18:40:15 GMT
Repository: allura
Updated Branches:
  refs/heads/master 14ccf22b4 -> c5b6ce55f


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/master
Commit: c5b6ce55f5aaf86bb7f5e926c0ff4ab2986f3ea1
Parents: 14ccf22
Author: Dave Brondsema <dave@brondsema.net>
Authored: Tue Jan 26 13:42:15 2016 -0500
Committer: Heith Seewald <heiths@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


Mime
View raw message