summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2023-08-21 18:27:04 -0400
committerChris McDonough <chrism@plope.com>2023-08-21 18:27:04 -0400
commitd4a821c7b134b983e72e653b17b5a25507552620 (patch)
tree6831a48b6dc4439621ea157c4a3967e8e3b1fa46
parent2af309223d6050feff3f85701a93166f3d4b5fee (diff)
downloadpyramid-d4a821c7b134b983e72e653b17b5a25507552620.tar.gz
pyramid-d4a821c7b134b983e72e653b17b5a25507552620.tar.bz2
pyramid-d4a821c7b134b983e72e653b17b5a25507552620.zip
re-add integration tests (bad merge) and add integration test for nulbyte check when asset spec override exists
-rw-r--r--tests/pkgs/static_abspath_nulbyte/__init__.py3
-rw-r--r--tests/pkgs/static_assetspec_nulbyte/__init__.py3
-rw-r--r--tests/test_integration.py22
3 files changed, 21 insertions, 7 deletions
diff --git a/tests/pkgs/static_abspath_nulbyte/__init__.py b/tests/pkgs/static_abspath_nulbyte/__init__.py
index a946fcdf9..2248522e9 100644
--- a/tests/pkgs/static_abspath_nulbyte/__init__.py
+++ b/tests/pkgs/static_abspath_nulbyte/__init__.py
@@ -3,8 +3,7 @@ import os
def includeme(config):
here = here = os.path.dirname(__file__)
- static
static = os.path.normpath(
- os.path.join(here, '..', '..', 'fixtures', 'statc')
+ os.path.join(here, '..', '..', 'fixtures', 'static')
)
config.add_static_view('/', static)
diff --git a/tests/pkgs/static_assetspec_nulbyte/__init__.py b/tests/pkgs/static_assetspec_nulbyte/__init__.py
index 49cebab3e..5ac6e8cf5 100644
--- a/tests/pkgs/static_assetspec_nulbyte/__init__.py
+++ b/tests/pkgs/static_assetspec_nulbyte/__init__.py
@@ -1,2 +1,5 @@
def includeme(config):
config.add_static_view('/', 'tests:fixtures/static')
+ config.add_static_view('/sub', 'tests:fixtures/static/subdir')
+ config.override_asset('tests:fixtures/static/subdir',
+ 'tests:fixtures/static')
diff --git a/tests/test_integration.py b/tests/test_integration.py
index 184368214..d14ee846e 100644
--- a/tests/test_integration.py
+++ b/tests/test_integration.py
@@ -220,18 +220,30 @@ class TestEventOnlySubscribers(IntegrationBase, unittest.TestCase):
class TestStaticAppUsingAbsPath(StaticAppBase, unittest.TestCase):
package = 'tests.pkgs.static_abspath'
- def test_nulbyte_chroot(self):
- super_w_null = '/static/..\x00/'
- res = self.testapp.get(f'/{super_w_null}', status=404)
-
class TestStaticAppUsingAssetSpec(StaticAppBase, unittest.TestCase):
package = 'tests.pkgs.static_assetspec'
+
+class TestStaticAppUsingAbsPathNulByte(IntegrationBase, unittest.TestCase):
+ package = 'tests.pkgs.static_abspath_nulbyte'
+
def test_nulbyte_chroot(self):
- super_w_null = 'static/..\x00/'
+ super_w_null = '..\x00/'
res = self.testapp.get(f'/{super_w_null}', status=404)
+class TestStaticAppUsingAssetSpecNulByte(IntegrationBase, unittest.TestCase):
+ package = 'tests.pkgs.static_assetspec_nulbyte'
+
+ def test_nulbyte_chroot(self):
+ super_w_null = '..\x00/'
+ res = self.testapp.get(f'/{super_w_null}', status=404)
+
+ def test_nulbyte_chroot_assetspec_override(self):
+ super_w_null = '..\x00/'
+ res = self.testapp.get(f'/sub/{super_w_null}', status=404)
+
+
class TestStaticAppWithEncodings(IntegrationBase, unittest.TestCase):
package = 'tests.pkgs.static_encodings'