Skip to content

Commit b153614

Browse files
committed
test (test_recipes): update test for asgi scope
1 parent 44ecff3 commit b153614

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

tests/asgi/test_testing_asgi.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,17 @@ def test_immediate_disconnect():
155155
client.simulate_get('/', asgi_disconnect_ttl=0)
156156

157157

158-
@pytest.mark.parametrize('path, expected', [
159-
('/cache/http%3A%2F%2Ffalconframework.org/status', True),
160-
('/cache/http%3A%2F%2Ffalconframework.org/status?param1=value1&param2=value2', False)
161-
])
162-
def test_create_scope_preserve_raw_path(path: str, expected: bool):
158+
@pytest.mark.parametrize(
159+
'path, expected',
160+
[
161+
('/cache/http%3A%2F%2Ffalconframework.org/status', True),
162+
(
163+
'/cache/http%3A%2F%2Ffalconframework.org/status?param1=value1&param2=value2',
164+
False,
165+
),
166+
],
167+
)
168+
def test_create_scope_preserve_raw_path(path, expected):
163169
scope = testing.create_scope(path=path)
164170
if expected:
165171
assert scope['raw_path'] == path.encode()

tests/test_recipes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,16 @@ def test_raw_path(self, asgi, app_kind, util):
132132
result1 = falcon.testing.simulate_get(
133133
recipe.app, url1, extras=self.path_extras(asgi, url1)
134134
)
135+
scope1 = falcon.testing.create_scope(url1)
135136
assert result1.status_code == 200
136137
assert result1.json == {'url': 'http://falconframework.org'}
138+
assert scope1['raw_path'] == url1.encode()
137139

138140
url2 = '/cache/http%3A%2F%2Ffalconframework.org/status'
139141
result2 = falcon.testing.simulate_get(
140142
recipe.app, url2, extras=self.path_extras(asgi, url2)
141143
)
144+
scope2 = falcon.testing.create_scope(url2)
142145
assert result2.status_code == 200
143146
assert result2.json == {'cached': True}
147+
assert scope2['raw_path'] == url2.encode()

0 commit comments

Comments
 (0)