From 7cfea665ffcd98b6dbf134c6a9e37a3aa2a46bab Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 25 Nov 2015 10:36:27 +0100 Subject: [PATCH] tests: Strip trailing slash for webserver paths. --- tests/integration/test_webserver.py | 3 +++ tests/integration/webserver.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/integration/test_webserver.py b/tests/integration/test_webserver.py index ae730ad3e..5e34e6c5c 100644 --- a/tests/integration/test_webserver.py +++ b/tests/integration/test_webserver.py @@ -53,6 +53,9 @@ def test_httpbin(httpbin, qtbot, path, content, expected): @pytest.mark.parametrize('line, verb, path, equal', [ ('127.0.0.1 - - [01/Jan/1990 00:00:00] "GET / HTTP/1.1" 200 -', 'GET', '/', True), + ('127.0.0.1 - - [01/Jan/1990 00:00:00] "GET /foo/ HTTP/1.1" 200 -', + 'GET', '/foo', True), + ('127.0.0.1 - - [01/Jan/1990 00:00:00] "GET / HTTP/1.1" 200 -', 'GET', '/foo', False), ('127.0.0.1 - - [01/Jan/1990 00:00:00] "GET / HTTP/1.1" 200 -', diff --git a/tests/integration/webserver.py b/tests/integration/webserver.py index 9afb575e8..756c00c81 100644 --- a/tests/integration/webserver.py +++ b/tests/integration/webserver.py @@ -73,7 +73,9 @@ class Request(testprocess.Line): assert match.group('protocol') == 'HTTP/1.1' assert self.verb == 'GET' - self.path = match.group('path') + path = match.group('path') + self.path = '/' if path == '/' else path.rstrip('/') + self.status = int(match.group('status')) missing_paths = ['/favicon.ico', '/does-not-exist']