Commit f629729b authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

slaprunner: fix test and add safety net

parent f0f742b6
...@@ -78,6 +78,9 @@ class SlaprunnerTestCase(unittest.TestCase): ...@@ -78,6 +78,9 @@ class SlaprunnerTestCase(unittest.TestCase):
#create slaprunner configuration #create slaprunner configuration
config = Config() config = Config()
config.setConfig() config.setConfig()
# We do not run tests if a user is already set (runner being used)
if os.path.exists(os.path.join(config.etc_dir, '.users')):
self.fail(msg="A user is already set, can not start tests")
workdir = os.path.join(config.runner_workdir, 'project') workdir = os.path.join(config.runner_workdir, 'project')
software_link = os.path.join(config.runner_workdir, 'softwareLink') software_link = os.path.join(config.runner_workdir, 'softwareLink')
views.app.config.update(**config.__dict__) views.app.config.update(**config.__dict__)
...@@ -263,6 +266,8 @@ class SlaprunnerTestCase(unittest.TestCase): ...@@ -263,6 +266,8 @@ class SlaprunnerTestCase(unittest.TestCase):
"""Start scenario 1 for deploying SR: Clone a project from git repository""" """Start scenario 1 for deploying SR: Clone a project from git repository"""
self.setAccount() self.setAccount()
folder = 'workspace/' + self.project folder = 'workspace/' + self.project
if os.path.exists(self.app.config['workspace'] + '/' + self.project):
shutil.rmtree(self.app.config['workspace'] + '/' + self.project)
data = { data = {
'repo': self.repo, 'repo': self.repo,
'user': 'Slaprunner test', 'user': 'Slaprunner test',
...@@ -308,7 +313,7 @@ class SlaprunnerTestCase(unittest.TestCase): ...@@ -308,7 +313,7 @@ class SlaprunnerTestCase(unittest.TestCase):
def test_openSR(self): def test_openSR(self):
"""Scenario 3: Open software release""" """Scenario 3: Open software release"""
self.test_cloneProject() self.test_cloneProject()
software = os.path.join(self.software, 'drupal') # Drupal SR must exist in SR folder software = os.path.join(self.software, 'helloworld') # Drupal SR must exist in SR folder
response = loadJson(self.app.post('/setCurrentProject', response = loadJson(self.app.post('/setCurrentProject',
data=dict(path=software), data=dict(path=software),
follow_redirects=True)) follow_redirects=True))
......
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