1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
|
From: Julian Andres Klode <juliank@ubuntu.com>
Date: Fri, 16 Aug 2019 00:19:34 +0500
Subject: Fix httpbin tests to use https
Last-Update: 2019-03-04
This is needed because httpbin now does https redirects and the
tests fail.
---
tests/test_browser.py | 6 +++---
tests/test_form.py | 8 ++++----
tests/test_stateful_browser.py | 4 ++--
tests/utils.py | 2 +-
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/tests/test_browser.py b/tests/test_browser.py
index c71cea8..8cc39fd 100644
--- a/tests/test_browser.py
+++ b/tests/test_browser.py
@@ -8,7 +8,7 @@ import pytest
def test_submit_online(httpbin):
- """Complete and submit the pizza form at http://httpbin.org/forms/post """
+ """Complete and submit the pizza form at https://httpbin.org/forms/post """
browser = mechanicalsoup.Browser()
page = browser.get(httpbin + "/forms/post")
form = page.soup.form
@@ -23,7 +23,7 @@ def test_submit_online(httpbin):
response = browser.submit(form, page.url)
- # helpfully the form submits to http://httpbin.org/post which simply
+ # helpfully the form submits to https://httpbin.org/post which simply
# returns the request headers in json format
json = response.json()
data = json["form"]
@@ -38,7 +38,7 @@ def test_submit_online(httpbin):
form_html = """
-<form method="post" action="http://httpbin.org/post">
+<form method="post" action="https://httpbin.org/post">
<input name="customer" value="Philip J. Fry"/>
<input name="telephone" value="555"/>
<textarea name="comments">freezer</textarea>
diff --git a/tests/test_form.py b/tests/test_form.py
index a97a5b4..81606a1 100644
--- a/tests/test_form.py
+++ b/tests/test_form.py
@@ -6,7 +6,7 @@ import pytest
def test_submit_online(httpbin):
- """Complete and submit the pizza form at http://httpbin.org/forms/post """
+ """Complete and submit the pizza form at https://httpbin.org/forms/post """
browser = mechanicalsoup.Browser()
page = browser.get(httpbin + "/forms/post")
form = mechanicalsoup.Form(page.soup.form)
@@ -25,7 +25,7 @@ def test_submit_online(httpbin):
response = browser.submit(form, page.url)
- # helpfully the form submits to http://httpbin.org/post which simply
+ # helpfully the form submits to https://httpbin.org/post which simply
# returns the request headers in json format
json = response.json()
data = json["form"]
@@ -37,7 +37,7 @@ def test_submit_online(httpbin):
def test_submit_set(httpbin):
- """Complete and submit the pizza form at http://httpbin.org/forms/post """
+ """Complete and submit the pizza form at https://httpbin.org/forms/post """
browser = mechanicalsoup.Browser()
page = browser.get(httpbin + "/forms/post")
form = mechanicalsoup.Form(page.soup.form)
@@ -51,7 +51,7 @@ def test_submit_set(httpbin):
response = browser.submit(form, page.url)
- # helpfully the form submits to http://httpbin.org/post which simply
+ # helpfully the form submits to https://httpbin.org/post which simply
# returns the request headers in json format
json = response.json()
data = json["form"]
diff --git a/tests/test_stateful_browser.py b/tests/test_stateful_browser.py
index 9fc1140..f188faf 100644
--- a/tests/test_stateful_browser.py
+++ b/tests/test_stateful_browser.py
@@ -25,7 +25,7 @@ def test_request_forward():
def test_submit_online(httpbin):
- """Complete and submit the pizza form at http://httpbin.org/forms/post """
+ """Complete and submit the pizza form at https://httpbin.org/forms/post """
browser = mechanicalsoup.StatefulBrowser()
browser.set_user_agent('testing MechanicalSoup')
browser.open(httpbin.url)
@@ -217,7 +217,7 @@ def test_verbose(capsys):
def test_new_control():
browser = mechanicalsoup.StatefulBrowser()
- browser.open("http://httpbin.org/forms/post")
+ browser.open("https://httpbin.org/forms/post")
browser.select_form("form")
with pytest.raises(mechanicalsoup.LinkNotFoundError):
# The control doesn't exist, yet.
diff --git a/tests/utils.py b/tests/utils.py
index 7db0a1a..da5c6c4 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -72,7 +72,7 @@ class HttpbinRemote:
"""Drop-in replacement for pytest-httpbin's httpbin fixture
that uses the remote httpbin server instead of a local one."""
def __init__(self):
- self.url = "http://httpbin.org"
+ self.url = "https://httpbin.org"
def __add__(self, x):
return self.url + x
|