Added regression tests for issue #1120
This commit is contained in:
parent
60774c5a49
commit
220b40f7f4
|
@ -174,6 +174,40 @@ def test_route_optional_slash():
|
|||
request, response = app.test_client.get('/get/')
|
||||
assert response.text == 'OK'
|
||||
|
||||
def test_route_strict_slashes_set_to_false_and_host_is_a_list():
|
||||
#Part of regression test for issue #1120
|
||||
app = Sanic('test_route_strict_slashes_set_to_false_and_host_is_a_list')
|
||||
|
||||
site1 = 'localhost:{}'.format(app.test_client.port)
|
||||
|
||||
#before fix, this raises a RouteExists error
|
||||
@app.get('/get', host=[site1, 'site2.com'], strict_slashes=False)
|
||||
def handler(request):
|
||||
return text('OK')
|
||||
|
||||
request, response = app.test_client.get('http://' + site1 + '/get')
|
||||
assert response.text == 'OK'
|
||||
|
||||
@app.post('/post', host=[site1, 'site2.com'], strict_slashes=False)
|
||||
def handler(request):
|
||||
return text('OK')
|
||||
|
||||
request, response = app.test_client.post('http://' + site1 +'/post')
|
||||
assert response.text == 'OK'
|
||||
|
||||
@app.put('/put', host=[site1, 'site2.com'], strict_slashes=False)
|
||||
def handler(request):
|
||||
return text('OK')
|
||||
|
||||
request, response = app.test_client.put('http://' + site1 +'/put')
|
||||
assert response.text == 'OK'
|
||||
|
||||
@app.delete('/delete', host=[site1, 'site2.com'], strict_slashes=False)
|
||||
def handler(request):
|
||||
return text('OK')
|
||||
|
||||
request, response = app.test_client.delete('http://' + site1 +'/delete')
|
||||
assert response.text == 'OK'
|
||||
|
||||
def test_shorthand_routes_post():
|
||||
app = Sanic('test_shorhand_routes_post')
|
||||
|
|
Loading…
Reference in New Issue
Block a user