Commit a763160b authored by Nicolas Wavrant's avatar Nicolas Wavrant

runner-tests: code apdated to the new behaviour of getting app parameters'value

parent 5bebf9d9
...@@ -120,6 +120,10 @@ class SlaprunnerTestCase(unittest.TestCase): ...@@ -120,6 +120,10 @@ class SlaprunnerTestCase(unittest.TestCase):
project = os.path.join(self.app.config['etc_dir'], '.project') project = os.path.join(self.app.config['etc_dir'], '.project')
users = os.path.join(self.app.config['etc_dir'], '.users') users = os.path.join(self.app.config['etc_dir'], '.users')
#reset tested parameters
self.updateConfigParameter('autorun', False)
self.updateConfigParameter('auto_deploy', True)
if os.path.exists(users): if os.path.exists(users):
os.unlink(users) os.unlink(users)
if os.path.exists(project): if os.path.exists(project):
...@@ -137,6 +141,15 @@ class SlaprunnerTestCase(unittest.TestCase): ...@@ -137,6 +141,15 @@ class SlaprunnerTestCase(unittest.TestCase):
killRunningProcess('slapgrid-cp', recursive=True) killRunningProcess('slapgrid-cp', recursive=True)
killRunningProcess('slapgrid-sr', recursive=True) killRunningProcess('slapgrid-sr', recursive=True)
def updateConfigParameter(self, parameter, value):
config_parser = ConfigParser.SafeConfigParser()
config_parser.read(os.getenv('RUNNER_CONFIG'))
for section in config_parser.sections():
if config_parser.has_option(section, parameter):
config_parser.set(section, parameter, str(value))
with open(os.getenv('RUNNER_CONFIG'), 'wb') as configfile:
config_parser.write(configfile)
def configAccount(self, username, password, email, name, rcode): def configAccount(self, username, password, email, name, rcode):
"""Helper for configAccount""" """Helper for configAccount"""
return self.app.post('/configAccount', return self.app.post('/configAccount',
...@@ -431,8 +444,8 @@ class SlaprunnerTestCase(unittest.TestCase): ...@@ -431,8 +444,8 @@ class SlaprunnerTestCase(unittest.TestCase):
"""Scenario 7: isSRReady won't overwrite the existing """Scenario 7: isSRReady won't overwrite the existing
Sofware Instance if it has been deployed yet""" Sofware Instance if it has been deployed yet"""
# Test that SR won't be deployed with auto_deploy=False # Test that SR won't be deployed with auto_deploy=False
self.app.config['auto_deploy'] = False self.updateConfigParameter('auto_deploy', False)
self.app.config['autorun'] = False self.updateConfigParameter('autorun', False)
project = open(os.path.join(self.app.config['etc_dir'], project = open(os.path.join(self.app.config['etc_dir'],
'.project'), "w") '.project'), "w")
project.write(self.software + 'slaprunner-test') project.write(self.software + 'slaprunner-test')
...@@ -440,7 +453,7 @@ class SlaprunnerTestCase(unittest.TestCase): ...@@ -440,7 +453,7 @@ class SlaprunnerTestCase(unittest.TestCase):
response = isSoftwareReleaseReady(self.app.config) response = isSoftwareReleaseReady(self.app.config)
self.assertEqual(response, "0") self.assertEqual(response, "0")
# Test if auto_deploy parameter starts the deployment of SR # Test if auto_deploy parameter starts the deployment of SR
self.app.config['auto_deploy'] = True self.updateConfigParameter('auto_deploy', True)
self.setupSoftwareFolder() self.setupSoftwareFolder()
response = isSoftwareReleaseReady(self.app.config) response = isSoftwareReleaseReady(self.app.config)
self.assertEqual(response, "2") self.assertEqual(response, "2")
......
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