summaryrefslogtreecommitdiff
path: root/pyramid/tests/test_url.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyramid/tests/test_url.py')
-rw-r--r--pyramid/tests/test_url.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/pyramid/tests/test_url.py b/pyramid/tests/test_url.py
index a7a565356..e33eeebfd 100644
--- a/pyramid/tests/test_url.py
+++ b/pyramid/tests/test_url.py
@@ -583,6 +583,21 @@ class TestURLMethodsMixin(unittest.TestCase):
self.assertEqual(result,
'http://example.com:5432/absstatic/test_url.py')
+ def test_static_url_noscheme_uses_scheme_from_request(self):
+ import os
+ from pyramid.interfaces import IStaticURLInfo
+ from pyramid.config.views import StaticURLInfo
+ info = StaticURLInfo()
+ here = os.path.abspath(os.path.dirname(__file__))
+ info.add(self.config, '//subdomain.example.com/static', here)
+ request = self._makeOne({'wsgi.url_scheme': 'https'})
+ registry = request.registry
+ registry.registerUtility(info, IStaticURLInfo)
+ abspath = os.path.join(here, 'test_url.py')
+ result = request.static_url(abspath)
+ self.assertEqual(result,
+ 'https://subdomain.example.com/static/test_url.py')
+
def test_static_path_abspath(self):
from pyramid.interfaces import IStaticURLInfo
request = self._makeOne()