Merge "allow non '/' root for dashboard"
diff --git a/tempest/scenario/test_dashboard_basic_ops.py b/tempest/scenario/test_dashboard_basic_ops.py
index eb018eb..8e91a6d 100644
--- a/tempest/scenario/test_dashboard_basic_ops.py
+++ b/tempest/scenario/test_dashboard_basic_ops.py
@@ -26,6 +26,7 @@
class HorizonHTMLParser(HTMLParser.HTMLParser):
csrf_token = None
region = None
+ login = None
def _find_name(self, attrs, name):
for attrpair in attrs:
@@ -39,12 +40,20 @@
return attrpair[1]
return None
+ def _find_attr_value(self, attrs, attr_name):
+ for attrpair in attrs:
+ if attrpair[0] == attr_name:
+ return attrpair[1]
+ return None
+
def handle_starttag(self, tag, attrs):
if tag == 'input':
if self._find_name(attrs, 'csrfmiddlewaretoken'):
self.csrf_token = self._find_value(attrs)
if self._find_name(attrs, 'region'):
self.region = self._find_value(attrs)
+ if tag == 'form':
+ self.login = self._find_attr_value(attrs, 'action')
class TestDashboardBasicOps(manager.ScenarioTest):
@@ -79,8 +88,12 @@
parser = HorizonHTMLParser()
parser.feed(response)
+ # construct login url for dashboard, discovery accomodates non-/ web
+ # root for dashboard
+ login_url = CONF.dashboard.dashboard_url + parser.login[1:]
+
# Prepare login form request
- req = request.Request(CONF.dashboard.login_url)
+ req = request.Request(login_url)
req.add_header('Content-type', 'application/x-www-form-urlencoded')
req.add_header('Referer', CONF.dashboard.dashboard_url)
params = {'username': username,