Commit 69a41bc8 authored by Alain Takoudjou's avatar Alain Takoudjou

webrunner resiliency test: fix get rcode from monitoring

parent 5fc07809
...@@ -37,6 +37,7 @@ import ssl ...@@ -37,6 +37,7 @@ import ssl
import string import string
import time import time
import urllib2 import urllib2
import urllib
class NotHttpOkException(Exception): class NotHttpOkException(Exception):
pass pass
...@@ -198,19 +199,18 @@ class SlaprunnerTestSuite(ResiliencyTestSuite): ...@@ -198,19 +199,18 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
def _getRcode(self): def _getRcode(self):
#XXX-Nicolas: hardcoded url. Best way right now to automate the tests... #XXX-Nicolas: hardcoded url. Best way right now to automate the tests...
monitoring_password = "passwordtochange" monitoring_password = "insecure"
monitor_url = self.monitor_url + "?script=zero-knowledge%2Fsettings.cgi" monitor_url = self.monitor_url + "/private/monitor.global.json"
result = self._opener_director.open(monitor_url, monitor_url = monitor_url.replace('https://', 'https://admin:%s@' % monitoring_password)
"password=" + monitoring_password + ";password_2=" + monitoring_password) result = urllib.urlopen(monitor_url)
if result.getcode() is not 200: if result.getcode() is not 200:
raise NotHttpOkException(result.getcode()) raise NotHttpOkException(result.getcode())
page = result.read().strip() monitor_json = json.loads(result.read())
html = etree.HTML(page) for parameter in monitor_json['parameters']:
if parameter['title'] == 'recovery-code':
input = html.xpath("//input[@name='recovery-code']") return parameter['value']
return input[0].get('value')
def generateData(self): def generateData(self):
self.slaprunner_password = ''.join( self.slaprunner_password = ''.join(
...@@ -233,7 +233,7 @@ class SlaprunnerTestSuite(ResiliencyTestSuite): ...@@ -233,7 +233,7 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
parameter_dict = self._getPartitionParameterDict() parameter_dict = self._getPartitionParameterDict()
self.slaprunner_backend_url = parameter_dict['backend_url'] self.slaprunner_backend_url = parameter_dict['backend_url']
self.logger.info('backend_url is %s.' % self.slaprunner_backend_url) self.logger.info('backend_url is %s.' % self.slaprunner_backend_url)
self.monitor_url = parameter_dict['monitor_backend_url'] self.monitor_url = parameter_dict['monitor-base-url']
slaprunner_recovery_code = self._getRcode() slaprunner_recovery_code = self._getRcode()
self.logger.debug('Creating the slaprunner account...') self.logger.debug('Creating the slaprunner account...')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment