From 8550fb3401c8450ad353cef931d8a3723aeb422f Mon Sep 17 00:00:00 2001 From: Panagiotis Ktistakis Date: Wed, 20 Apr 2016 17:58:14 +0300 Subject: [PATCH] Add tests for {url:pretty} variable --- tests/integration/data/title with spaces.html | 10 ++++++++++ tests/integration/features/conftest.py | 4 +++- tests/integration/features/spawn.feature | 13 ++++++++++++- 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 tests/integration/data/title with spaces.html diff --git a/tests/integration/data/title with spaces.html b/tests/integration/data/title with spaces.html new file mode 100644 index 000000000..d5e2ab9da --- /dev/null +++ b/tests/integration/data/title with spaces.html @@ -0,0 +1,10 @@ + + + + + Test title + + + foo + + diff --git a/tests/integration/features/conftest.py b/tests/integration/features/conftest.py index 2ff052937..414f882d7 100644 --- a/tests/integration/features/conftest.py +++ b/tests/integration/features/conftest.py @@ -275,10 +275,12 @@ def expect_message(quteproc, httpbin, category, message): @bdd.then(bdd.parsers.re(r'(?Pregex )?"(?P[^"]+)" should ' r'be logged')) -def should_be_logged(quteproc, is_regex, pattern): +def should_be_logged(quteproc, httpbin, is_regex, pattern): """Expect the given pattern on regex in the log.""" if is_regex: pattern = re.compile(pattern) + else: + pattern = pattern.replace('(port)', str(httpbin.port)) line = quteproc.wait_for(message=pattern) line.expected = True diff --git a/tests/integration/features/spawn.feature b/tests/integration/features/spawn.feature index 03506c18b..861091f91 100644 --- a/tests/integration/features/spawn.feature +++ b/tests/integration/features/spawn.feature @@ -16,9 +16,20 @@ Feature: :spawn When I run :spawn echo {url} Then "Executing echo with args ['about:blank'], userscript=False" should be logged + Scenario: Running :spawn with url variable in fully encoded format + When I open data/title with spaces.html + And I run :spawn echo {url} + Then "Executing echo with args ['http://localhost:(port)/data/title%20with%20spaces.html'], userscript=False" should be logged + + Scenario: Running :spawn with url variable in pretty decoded format + When I open data/title with spaces.html + And I run :spawn echo {url:pretty} + Then "Executing echo with args ['http://localhost:(port)/data/title with spaces.html'], userscript=False" should be logged + @posix Scenario: Running :spawn with userscript - When I execute the userscript open_current_url + When I open about:blank + And I execute the userscript open_current_url And I wait until about:blank is loaded Then the following tabs should be open: - about:blank