Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[py3] Fixed staticfiles tests

  • Loading branch information...
commit 7d48e077b573afb4184301be6565a88e8a9b6e28 1 parent 9cb8035
@claudep claudep authored
View
4 django/contrib/staticfiles/storage.py
@@ -51,8 +51,8 @@ class CachedFilesMixin(object):
default_template = """url("%s")"""
patterns = (
("*.css", (
- br"""(url\(['"]{0,1}\s*(.*?)["']{0,1}\))""",
- (br"""(@import\s*["']\s*(.*?)["'])""", """@import url("%s")"""),
+ r"""(url\(['"]{0,1}\s*(.*?)["']{0,1}\))""",
+ (r"""(@import\s*["']\s*(.*?)["'])""", """@import url("%s")"""),
)),
)
View
2  django/utils/encoding.py
@@ -225,7 +225,7 @@ def filepath_to_uri(path):
return path
# I know about `os.sep` and `os.altsep` but I want to leave
# some flexibility for hardcoding separators.
- return quote(smart_bytes(path).replace("\\", "/"), safe=b"/~!*()'")
+ return quote(smart_bytes(path.replace("\\", "/")), safe=b"/~!*()'")
# The encoding of the default system locale but falls back to the
# given fallback encoding if the encoding is unsupported by python or could
View
8 tests/regressiontests/staticfiles_tests/tests.py
@@ -527,11 +527,11 @@ def test_cache_key_memcache_validation(self):
"""
Handle cache key creation correctly, see #17861.
"""
- name = b"/some crazy/long filename/ with spaces Here and ?#%#$/other/stuff/some crazy/long filename/ with spaces Here and ?#%#$/other/stuff/some crazy/long filename/ with spaces Here and ?#%#$/other/stuff/some crazy/long filename/ with spaces Here and ?#%#$/other/stuff/some crazy/long filename/ with spaces Here and ?#%#$/other/stuff/some crazy/" + chr(22) + chr(180)
+ name = "/some crazy/long filename/ with spaces Here and ?#%#$/other/stuff/some crazy/long filename/ with spaces Here and ?#%#$/other/stuff/some crazy/long filename/ with spaces Here and ?#%#$/other/stuff/some crazy/long filename/ with spaces Here and ?#%#$/other/stuff/some crazy/long filename/ with spaces Here and ?#%#$/other/stuff/some crazy/" + "\x16" + "\xb4"
cache_key = storage.staticfiles_storage.cache_key(name)
cache_validator = BaseCache({})
cache_validator.validate_key(cache_key)
- self.assertEqual(cache_key, 'staticfiles:e95bbc36387084582df2a70750d7b351')
+ self.assertEqual(cache_key, 'staticfiles:821ea71ef36f95b3922a77f7364670e7')
# we set DEBUG to False here since the template tag wouldn't work otherwise
@@ -569,8 +569,8 @@ def test_template_tag_simple_content(self):
self.assertEqual(relpath, "cached/styles.deploy12345.css")
with storage.staticfiles_storage.open(relpath) as relfile:
content = relfile.read()
- self.assertNotIn("cached/other.css", content)
- self.assertIn("other.deploy12345.css", content)
+ self.assertNotIn(b"cached/other.css", content)
+ self.assertIn(b"other.deploy12345.css", content)
if sys.platform != 'win32':
Please sign in to comment.
Something went wrong with that request. Please try again.