summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Goirand <zigo@debian.org>2018-06-15 12:37:24 +0200
committerThomas Goirand <zigo@debian.org>2018-06-15 12:38:31 +0200
commit5b59210ef2b52d56150d6dd3719ed189ad9225ff (patch)
tree9abf2e78f66c0b2b2d8b160e9a12a17661c4cb07
parenta23f4074fd458b74e9de1a583b7812e1ef855bce (diff)
Fix for python 3HEADmaster
In Python 3, get_reponse returns a bytes object, not str, so we have to encode() and decode(), otherwise it fails. This fixed issues running the tests in Debian. Change-Id: Ifc18bb48e27cee96864e3a9b64d8a4fd294a912b
Notes
Notes (review): Code-Review+2: David Lyle <dklyle0@gmail.com> Workflow+1: David Lyle <dklyle0@gmail.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Thu, 12 Jul 2018 21:18:25 +0000 Reviewed-on: https://review.openstack.org/575714 Project: openstack/tempest-horizon Branch: refs/heads/master
-rw-r--r--tempest_horizon/tests/scenario/test_dashboard_basic_ops.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tempest_horizon/tests/scenario/test_dashboard_basic_ops.py b/tempest_horizon/tests/scenario/test_dashboard_basic_ops.py
index cd4af56..815b17a 100644
--- a/tempest_horizon/tests/scenario/test_dashboard_basic_ops.py
+++ b/tempest_horizon/tests/scenario/test_dashboard_basic_ops.py
@@ -84,14 +84,14 @@ class TestDashboardBasicOps(test.BaseTestCase):
84 84
85 def check_login_page(self): 85 def check_login_page(self):
86 response = self._get_opener().open(CONF.dashboard.dashboard_url).read() 86 response = self._get_opener().open(CONF.dashboard.dashboard_url).read()
87 self.assertIn("id_username", response) 87 self.assertIn("id_username", response.decode("utf-8"))
88 88
89 def user_login(self, username, password): 89 def user_login(self, username, password):
90 response = self._get_opener().open(CONF.dashboard.dashboard_url).read() 90 response = self._get_opener().open(CONF.dashboard.dashboard_url).read()
91 91
92 # Grab the CSRF token and default region 92 # Grab the CSRF token and default region
93 parser = HorizonHTMLParser() 93 parser = HorizonHTMLParser()
94 parser.feed(response) 94 parser.feed(response.decode("utf-8"))
95 95
96 # construct login url for dashboard, discovery accommodates non-/ web 96 # construct login url for dashboard, discovery accommodates non-/ web
97 # root for dashboard 97 # root for dashboard
@@ -109,11 +109,11 @@ class TestDashboardBasicOps(test.BaseTestCase):
109 'region': parser.region, 109 'region': parser.region,
110 'domain': CONF.auth.default_credentials_domain_name, 110 'domain': CONF.auth.default_credentials_domain_name,
111 'csrfmiddlewaretoken': parser.csrf_token} 111 'csrfmiddlewaretoken': parser.csrf_token}
112 self._get_opener().open(req, parse.urlencode(params)) 112 self._get_opener().open(req, parse.urlencode(params).encode())
113 113
114 def check_home_page(self): 114 def check_home_page(self):
115 response = self._get_opener().open(CONF.dashboard.dashboard_url).read() 115 response = self._get_opener().open(CONF.dashboard.dashboard_url).read()
116 self.assertIn('Overview', response) 116 self.assertIn('Overview', response.decode("utf-8"))
117 117
118 def _get_opener(self): 118 def _get_opener(self):
119 if not self.opener: 119 if not self.opener: