This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git


The following commit(s) were added to refs/heads/master by this push:
     new a5a3d9658 change httpbin service used in a few tests
a5a3d9658 is described below

commit a5a3d9658b7f782f8d77c9d544a717c5d24490d8
Author: Dave Brondsema <[email protected]>
AuthorDate: Wed Sep 11 12:23:50 2024 -0400

    change httpbin service used in a few tests
---
 Allura/allura/tests/test_helpers.py              | 13 ++++++++-----
 ForgeImporters/forgeimporters/tests/test_base.py |  5 +++--
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/Allura/allura/tests/test_helpers.py 
b/Allura/allura/tests/test_helpers.py
index 50a6e6e11..e62f4ef6a 100644
--- a/Allura/allura/tests/test_helpers.py
+++ b/Allura/allura/tests/test_helpers.py
@@ -44,6 +44,9 @@ from allura.tests import decorators as td
 from alluratest.controller import setup_basic_test
 import six
 
+# httpbin.org should work, but lately has been unreliable
+# httpbin.io does not allow /redirect-to to localhost
+httpbin_domain = 'httpbin.dev'
 
 def setup_module():
     setup_basic_test()
@@ -480,17 +483,17 @@ class TestUrlOpen:
         'http://localhost/',
         'https://localhost/',
         'http://localhost:8080',
-        'https://httpbin.org/redirect-to?url=http://localhost',
-        'https://httpbin.org/redirect-to?url=https://localhost',
+        f'https://{httpbin_domain}/redirect-to?url=http://localhost',
+        f'https://{httpbin_domain}/redirect-to?url=https://localhost',
     ])
     def test_internal_invalid(self, url):
         with pytest.raises(fev.Invalid):
             h.urlopen(url)
 
     @pytest.mark.parametrize('url', [
-        'http://httpbin.org/status/200',
-        'https://httpbin.org/status/200',
-        'http://httpbin.org:80/status/200',
+        f'http://{httpbin_domain}/status/200',
+        f'https://{httpbin_domain}/status/200',
+        f'http://{httpbin_domain}:80/status/200',
     ])
     def test_ok(self, url):
         h.urlopen(url)
diff --git a/ForgeImporters/forgeimporters/tests/test_base.py 
b/ForgeImporters/forgeimporters/tests/test_base.py
index b009e9f5a..dc8e5b1aa 100644
--- a/ForgeImporters/forgeimporters/tests/test_base.py
+++ b/ForgeImporters/forgeimporters/tests/test_base.py
@@ -24,6 +24,7 @@ import pytest
 from tg import expose, config
 from webob.exc import HTTPUnauthorized
 
+from allura.tests.test_helpers import httpbin_domain
 from alluratest.controller import TestController, setup_basic_test
 from allura.tests import decorators as td
 from allura.lib import helpers as h
@@ -58,11 +59,11 @@ class TestProjectExtractor(TestCase):
             base.ProjectExtractor.urlopen('http://localhost:1234/blah', 
data=b'foo')
 
         # redirect to external site ok
-        
base.ProjectExtractor.urlopen('https://httpbin.org/redirect-to?url=http%3A%2F%2Fexample.com%2F')
+        
base.ProjectExtractor.urlopen(f'https://{httpbin_domain}/redirect-to?url=http%3A%2F%2Fexample.com%2F')
 
         # redirect to internal is blocked
         with pytest.raises(Invalid):
-            
base.ProjectExtractor.urlopen('https://httpbin.org/redirect-to?url=http%3A%2F%2Flocalhost%2F')
+            
base.ProjectExtractor.urlopen(f'https://{httpbin_domain}/redirect-to?url=http%3A%2F%2Flocalhost%2F')
 
     @mock.patch('forgeimporters.base.h.urlopen')
     @mock.patch('urllib.request.Request')

Reply via email to