spiderweb-framework 1.2.0__tar.gz → 1.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/PKG-INFO +2 -2
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/pyproject.toml +5 -3
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/constants.py +1 -1
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/main.py +2 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/response.py +4 -2
- spiderweb_framework-1.2.1/spiderweb/tests/staticfiles/.gitkeep +0 -0
- spiderweb_framework-1.2.1/spiderweb/tests/staticfiles/file_for_testing_fileresponse.txt +1 -0
- spiderweb_framework-1.2.1/spiderweb/tests/staticfiles/style.css +6 -0
- spiderweb_framework-1.2.1/spiderweb/tests/test_cookies.py +149 -0
- spiderweb_framework-1.2.1/spiderweb/tests/test_jinja_extras.py +35 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/tests/test_responses.py +93 -0
- spiderweb_framework-1.2.1/spiderweb/tests/test_server.py +15 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/LICENSE.txt +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/README.md +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/__init__.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/converters.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/db.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/decorators.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/default_views.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/example_validator.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/exceptions.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/jinja_core.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/jinja_extensions.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/local_server.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/middleware/__init__.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/middleware/base.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/middleware/cors.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/middleware/csrf.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/middleware/pydantic.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/middleware/sessions.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/request.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/routes.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/secrets.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/server_checks.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/tests/__init__.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/tests/helpers.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/tests/middleware.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/tests/test.html +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/tests/test_middleware.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/tests/test_variable_urls.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/tests/views_for_tests.py +0 -0
- {spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: spiderweb-framework
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.1
|
|
4
4
|
Summary: A small web framework, just big enough for a spider.
|
|
5
5
|
License: LICENSE.txt
|
|
6
6
|
Author: Joe Kaufeld
|
|
@@ -12,8 +12,8 @@ Classifier: Intended Audience :: Developers
|
|
|
12
12
|
Classifier: License :: Other/Proprietary License
|
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
16
15
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.13
|
|
18
18
|
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
|
|
19
19
|
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "spiderweb-framework"
|
|
3
|
-
version = "1.2.
|
|
3
|
+
version = "1.2.1"
|
|
4
4
|
description = "A small web framework, just big enough for a spider."
|
|
5
5
|
authors = ["Joe Kaufeld <opensource@joekaufeld.com>"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -62,7 +62,7 @@ addopts = ["--maxfail=2", "-rf"]
|
|
|
62
62
|
|
|
63
63
|
[tool.coverage.run]
|
|
64
64
|
branch = true
|
|
65
|
-
omit = ["conftest.py"]
|
|
65
|
+
omit = ["conftest.py", "spiderweb/tests/*"]
|
|
66
66
|
|
|
67
67
|
[tool.coverage.report]
|
|
68
68
|
# Regexes for lines to exclude from consideration
|
|
@@ -81,6 +81,8 @@ exclude_also = [
|
|
|
81
81
|
|
|
82
82
|
# Don't complain about abstract methods, they aren't run:
|
|
83
83
|
"@(abc\\.)?abstractmethod",
|
|
84
|
-
|
|
84
|
+
# Type checking lines are never run:
|
|
85
|
+
"if TYPE_CHECKING:",
|
|
86
|
+
]
|
|
85
87
|
|
|
86
88
|
ignore_errors = true
|
|
@@ -2,7 +2,7 @@ from peewee import DatabaseProxy
|
|
|
2
2
|
|
|
3
3
|
DEFAULT_ALLOWED_METHODS = ["POST", "GET", "PUT", "PATCH", "DELETE"]
|
|
4
4
|
DEFAULT_ENCODING = "UTF-8"
|
|
5
|
-
__version__ = "1.2.
|
|
5
|
+
__version__ = "1.2.1"
|
|
6
6
|
|
|
7
7
|
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie
|
|
8
8
|
REGEX_COOKIE_NAME = r"^[a-zA-Z0-9\s\(\)<>@,;:\/\\\[\]\?=\{\}\"\t]*$"
|
|
@@ -175,6 +175,8 @@ class SpiderwebRouter(LocalServerMixin, MiddlewareMixin, RoutesMixin, FernetMixi
|
|
|
175
175
|
)
|
|
176
176
|
|
|
177
177
|
if self.staticfiles_dirs:
|
|
178
|
+
if not isinstance(self.staticfiles_dirs, list):
|
|
179
|
+
self.staticfiles_dirs = [self.staticfiles_dirs]
|
|
178
180
|
for static_dir in self.staticfiles_dirs:
|
|
179
181
|
static_dir = pathlib.Path(static_dir)
|
|
180
182
|
if not pathlib.Path(self.BASE_DIR / static_dir).exists():
|
|
@@ -29,8 +29,10 @@ class HttpResponse:
|
|
|
29
29
|
self.data = data
|
|
30
30
|
self.context = context if context else {}
|
|
31
31
|
self.status_code = status_code
|
|
32
|
-
self.
|
|
33
|
-
self.headers = Headers(
|
|
32
|
+
self._headers = headers if headers else {}
|
|
33
|
+
self.headers = Headers()
|
|
34
|
+
for k, v in self._headers.items():
|
|
35
|
+
self.headers[k.lower()] = v
|
|
34
36
|
if not self.headers.get("content-type"):
|
|
35
37
|
self.headers["content-type"] = "text/html; charset=utf-8"
|
|
36
38
|
self.headers["server"] = "Spiderweb"
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
hi
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
from spiderweb import HttpResponse
|
|
6
|
+
from spiderweb.exceptions import GeneralException
|
|
7
|
+
from spiderweb.tests.helpers import setup
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_valid_cookie():
|
|
11
|
+
app, environ, start_response = setup()
|
|
12
|
+
|
|
13
|
+
@app.route("/")
|
|
14
|
+
def index(request):
|
|
15
|
+
resp = HttpResponse("Hello, World!")
|
|
16
|
+
resp.set_cookie("cookie", "value")
|
|
17
|
+
return resp
|
|
18
|
+
|
|
19
|
+
response = app(environ, start_response)
|
|
20
|
+
assert response == [b"Hello, World!"]
|
|
21
|
+
assert start_response.get_headers()["set-cookie"] == "cookie=value"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_invalid_cookie_name():
|
|
25
|
+
app, environ, start_response = setup()
|
|
26
|
+
|
|
27
|
+
@app.route("/")
|
|
28
|
+
def index(request):
|
|
29
|
+
resp = HttpResponse("Hello, World!")
|
|
30
|
+
resp.set_cookie("cookie$%^&*name", "value")
|
|
31
|
+
return resp
|
|
32
|
+
|
|
33
|
+
with pytest.raises(GeneralException) as exc:
|
|
34
|
+
app(environ, start_response)
|
|
35
|
+
|
|
36
|
+
assert str(exc.value) == (
|
|
37
|
+
"GeneralException() - Cookie name has illegal characters."
|
|
38
|
+
" See https://developer.mozilla.org/en-US/docs/Web/HTTP/"
|
|
39
|
+
"Headers/Set-Cookie#attributes for information on allowed"
|
|
40
|
+
" characters."
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def test_cookie_with_domain():
|
|
45
|
+
app, environ, start_response = setup()
|
|
46
|
+
|
|
47
|
+
@app.route("/")
|
|
48
|
+
def index(request):
|
|
49
|
+
resp = HttpResponse("Hello, World!")
|
|
50
|
+
resp.set_cookie("cookie", "value", domain="example.com")
|
|
51
|
+
return resp
|
|
52
|
+
|
|
53
|
+
response = app(environ, start_response)
|
|
54
|
+
assert response == [b"Hello, World!"]
|
|
55
|
+
assert (
|
|
56
|
+
start_response.get_headers()["set-cookie"] == "cookie=value; Domain=example.com"
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def test_cookie_with_expires():
|
|
61
|
+
app, environ, start_response = setup()
|
|
62
|
+
expiry_time = datetime(2024, 10, 22, 7, 28)
|
|
63
|
+
expiry_time_str = expiry_time.strftime("%a, %d %b %Y %H:%M:%S GMT")
|
|
64
|
+
|
|
65
|
+
@app.route("/")
|
|
66
|
+
def index(request):
|
|
67
|
+
resp = HttpResponse("Hello, World!")
|
|
68
|
+
resp.set_cookie("cookie", "value", expires=expiry_time)
|
|
69
|
+
return resp
|
|
70
|
+
|
|
71
|
+
response = app(environ, start_response)
|
|
72
|
+
assert response == [b"Hello, World!"]
|
|
73
|
+
assert (
|
|
74
|
+
start_response.get_headers()["set-cookie"]
|
|
75
|
+
== f"cookie=value; Expires={expiry_time_str}"
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def test_cookie_with_max_age():
|
|
80
|
+
app, environ, start_response = setup()
|
|
81
|
+
|
|
82
|
+
@app.route("/")
|
|
83
|
+
def index(request):
|
|
84
|
+
resp = HttpResponse("Hello, World!")
|
|
85
|
+
resp.set_cookie("cookie", "value", max_age=3600)
|
|
86
|
+
return resp
|
|
87
|
+
|
|
88
|
+
response = app(environ, start_response)
|
|
89
|
+
assert response == [b"Hello, World!"]
|
|
90
|
+
assert start_response.get_headers()["set-cookie"] == "cookie=value; Max-Age=3600"
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def test_cookie_with_invalid_samesite_attr():
|
|
94
|
+
app, environ, start_response = setup()
|
|
95
|
+
|
|
96
|
+
@app.route("/")
|
|
97
|
+
def index(request):
|
|
98
|
+
resp = HttpResponse("Hello, World!")
|
|
99
|
+
resp.set_cookie("cookie", "value", same_site="invalid")
|
|
100
|
+
return resp
|
|
101
|
+
|
|
102
|
+
with pytest.raises(GeneralException) as exc:
|
|
103
|
+
app(environ, start_response)
|
|
104
|
+
|
|
105
|
+
assert str(exc.value) == (
|
|
106
|
+
"GeneralException() - Invalid value invalid for `same_site` cookie"
|
|
107
|
+
" attribute. Valid options are 'strict', 'lax', or 'none'."
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def test_cookie_partitioned_attr():
|
|
112
|
+
app, environ, start_response = setup()
|
|
113
|
+
|
|
114
|
+
@app.route("/")
|
|
115
|
+
def index(request):
|
|
116
|
+
resp = HttpResponse()
|
|
117
|
+
resp.set_cookie("cookie", "value", partitioned=True)
|
|
118
|
+
return resp
|
|
119
|
+
|
|
120
|
+
app(environ, start_response)
|
|
121
|
+
assert start_response.get_headers()["set-cookie"] == "cookie=value; Partitioned"
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def test_cookie_secure_attr():
|
|
125
|
+
app, environ, start_response = setup()
|
|
126
|
+
|
|
127
|
+
@app.route("/")
|
|
128
|
+
def index(request):
|
|
129
|
+
resp = HttpResponse()
|
|
130
|
+
resp.set_cookie("cookie", "value", secure=True)
|
|
131
|
+
return resp
|
|
132
|
+
|
|
133
|
+
app(environ, start_response)
|
|
134
|
+
assert start_response.get_headers()["set-cookie"] == "cookie=value; Secure"
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def test_setting_multiple_cookies():
|
|
138
|
+
app, environ, start_response = setup()
|
|
139
|
+
|
|
140
|
+
@app.route("/")
|
|
141
|
+
def index(request):
|
|
142
|
+
resp = HttpResponse()
|
|
143
|
+
resp.set_cookie("cookie1", "value1")
|
|
144
|
+
resp.set_cookie("cookie2", "value2")
|
|
145
|
+
return resp
|
|
146
|
+
|
|
147
|
+
app(environ, start_response)
|
|
148
|
+
assert start_response.headers[-1] == ("set-cookie", "cookie2=value2")
|
|
149
|
+
assert start_response.headers[-2] == ("set-cookie", "cookie1=value1")
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from spiderweb.constants import DEFAULT_ENCODING
|
|
2
|
+
from spiderweb.response import TemplateResponse
|
|
3
|
+
from spiderweb.tests.helpers import setup
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_str_template_with_static_tag():
|
|
7
|
+
# test that the static tag works
|
|
8
|
+
template = """
|
|
9
|
+
<html>
|
|
10
|
+
<head>
|
|
11
|
+
<title>{{ title }}</title>
|
|
12
|
+
<link rel="stylesheet" href="{% static 'style.css' %}">
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<h1>{{ title }}</h1>
|
|
16
|
+
<p>{{ content }}</p>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
|
19
|
+
"""
|
|
20
|
+
context = {"title": "Test", "content": "This is a test."}
|
|
21
|
+
app, environ, start_response = setup(
|
|
22
|
+
staticfiles_dirs=["spiderweb/tests/staticfiles"], static_url="blorp"
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
@app.route("/")
|
|
26
|
+
def index(request):
|
|
27
|
+
return TemplateResponse(request, template_string=template, context=context)
|
|
28
|
+
|
|
29
|
+
rendered_template = (
|
|
30
|
+
template.replace("{% static 'style.css' %}", "/blorp/style.css")
|
|
31
|
+
.replace("{{ title }}", "Test")
|
|
32
|
+
.replace("{{ content }}", "This is a test.")
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
assert app(environ, start_response) == [bytes(rendered_template, DEFAULT_ENCODING)]
|
|
@@ -7,12 +7,14 @@ from spiderweb.exceptions import (
|
|
|
7
7
|
SpiderwebNetworkException,
|
|
8
8
|
SpiderwebException,
|
|
9
9
|
ReverseNotFound,
|
|
10
|
+
GeneralException,
|
|
10
11
|
)
|
|
11
12
|
from spiderweb.response import (
|
|
12
13
|
HttpResponse,
|
|
13
14
|
JsonResponse,
|
|
14
15
|
TemplateResponse,
|
|
15
16
|
RedirectResponse,
|
|
17
|
+
FileResponse,
|
|
16
18
|
)
|
|
17
19
|
from hypothesis import given, strategies as st
|
|
18
20
|
|
|
@@ -240,3 +242,94 @@ def test_reverse_nonexistent_view():
|
|
|
240
242
|
|
|
241
243
|
with pytest.raises(ReverseNotFound):
|
|
242
244
|
app.reverse("qwer")
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
def test_setting_content_type_header():
|
|
248
|
+
app, environ, start_response = setup()
|
|
249
|
+
|
|
250
|
+
@app.route("/")
|
|
251
|
+
def index(request):
|
|
252
|
+
resp = HttpResponse("Hello, World!", headers={"content-type": "text/html"})
|
|
253
|
+
return resp
|
|
254
|
+
|
|
255
|
+
response = app(environ, start_response)
|
|
256
|
+
assert response == [b"Hello, World!"]
|
|
257
|
+
assert start_response.get_headers()["content-type"] == "text/html"
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
def test_httpresponse_str_returns_body():
|
|
261
|
+
resp = HttpResponse("Hello, World!")
|
|
262
|
+
assert str(resp) == "Hello, World!"
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
def test_template_response_with_no_templates_raises_errors():
|
|
266
|
+
app, environ, start_response = setup()
|
|
267
|
+
|
|
268
|
+
@app.route("/")
|
|
269
|
+
def index(request):
|
|
270
|
+
return TemplateResponse(request, "")
|
|
271
|
+
|
|
272
|
+
with pytest.raises(GeneralException) as exc:
|
|
273
|
+
app(environ, start_response)
|
|
274
|
+
|
|
275
|
+
assert (
|
|
276
|
+
str(exc.value) == "GeneralException() - TemplateResponse requires a template."
|
|
277
|
+
)
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
def test_template_response_with_no_template_dirs():
|
|
281
|
+
|
|
282
|
+
template = TemplateResponse("", "test.html")
|
|
283
|
+
|
|
284
|
+
with pytest.raises(GeneralException) as exc:
|
|
285
|
+
template.render()
|
|
286
|
+
|
|
287
|
+
assert str(exc.value) == (
|
|
288
|
+
"GeneralException() - TemplateResponse has no loader. Did you set templates_dirs?"
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
def test_file_response():
|
|
293
|
+
resp = FileResponse("spiderweb/tests/staticfiles/file_for_testing_fileresponse.txt")
|
|
294
|
+
assert resp.headers["content-type"] == "text/plain"
|
|
295
|
+
assert resp.render() == [b"hi"]
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
def test_requesting_static_file():
|
|
299
|
+
app, environ, start_response = setup(
|
|
300
|
+
staticfiles_dirs=["spiderweb/tests/staticfiles"], debug=True
|
|
301
|
+
)
|
|
302
|
+
|
|
303
|
+
environ["PATH_INFO"] = "/static/file_for_testing_fileresponse.txt"
|
|
304
|
+
|
|
305
|
+
assert app(environ, start_response) == [b"hi"]
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
def test_requesting_nonexistent_static_file():
|
|
309
|
+
app, environ, start_response = setup(
|
|
310
|
+
staticfiles_dirs=["spiderweb/tests/staticfiles"], debug=True
|
|
311
|
+
)
|
|
312
|
+
|
|
313
|
+
environ["PATH_INFO"] = "/static/does_not_exist.txt"
|
|
314
|
+
|
|
315
|
+
assert app(environ, start_response) == [
|
|
316
|
+
b"Something went wrong.\n\n"
|
|
317
|
+
b"Code: 404\n\n"
|
|
318
|
+
b"Msg: Not Found\n\n"
|
|
319
|
+
b"Desc: The requested resource could not be found"
|
|
320
|
+
]
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
def test_static_file_with_unsafe_path():
|
|
324
|
+
app, environ, start_response = setup(
|
|
325
|
+
staticfiles_dirs=["spiderweb/tests/staticfiles"], debug=True
|
|
326
|
+
)
|
|
327
|
+
|
|
328
|
+
environ["PATH_INFO"] = "/static/../__init__.py"
|
|
329
|
+
|
|
330
|
+
assert app(environ, start_response) == [
|
|
331
|
+
b"Something went wrong.\n\n"
|
|
332
|
+
b"Code: 404\n\n"
|
|
333
|
+
b"Msg: Not Found\n\n"
|
|
334
|
+
b"Desc: The requested resource could not be found"
|
|
335
|
+
]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from spiderweb.exceptions import ConfigError
|
|
4
|
+
from spiderweb.tests.helpers import setup
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def test_staticfiles_dirs_option():
|
|
8
|
+
app, environ, start_response = setup(staticfiles_dirs="spiderweb/tests/staticfiles")
|
|
9
|
+
|
|
10
|
+
assert app.staticfiles_dirs == ["spiderweb/tests/staticfiles"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_staticfiles_dirs_not_found():
|
|
14
|
+
with pytest.raises(ConfigError):
|
|
15
|
+
app, environ, start_response = setup(staticfiles_dirs="not/a/real/path")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{spiderweb_framework-1.2.0 → spiderweb_framework-1.2.1}/spiderweb/tests/test_variable_urls.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|