diff options
author | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2014-02-18 15:31:04 +0000 |
---|---|---|
committer | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2014-02-18 15:31:04 +0000 |
commit | 512758d5c0fd25e609ccae9b91680c60914278b3 (patch) | |
tree | e2162d44b8d09cf88b97aa6adceb60d560d5cacc | |
parent | c0a7ee33e6a656b780613df422998c78c565ee24 (diff) | |
download | system-tests-512758d5c0fd25e609ccae9b91680c60914278b3.tar.gz |
create and delete repos for each test case (where needed)
-rwxr-xr-x | test.py | 22 |
1 files changed, 12 insertions, 10 deletions
@@ -48,9 +48,9 @@ def create_test_project(url, project): 'Users with read access to ' + project]) remote_runcmd(url, ['group', 'addgroup', t('readers'), t('writers')]) -def delete_repo(trove_id, project, repo): +def delete_repo(repopath): output = subprocess.check_output(['ssh', 'git@%s' % trove_id, - 'destroy', '%s/%s/%s' % (trove_id, project, repo)], + 'destroy', repopath], stderr=subprocess.STDOUT) # The destroy command gives us back a token, @@ -61,11 +61,8 @@ def delete_repo(trove_id, project, repo): subprocess.check_output(['ssh', 'git@ct-ri-4', 'destroy', '%s/%s/%s' % (trove_id, project, repo), token]) -def create_test_repo(remote_url, project, repo): - trove_id = 'ct-ri-4' #self.vm_nhame - - remote_runcmd(remote_url, - ['create', "%s/%s/%s" % (trove_id, project, repo)]) +def create_repo(repopath): + remote_runcmd('git@' + trove_id, ['create', repopath]) def can_clone(url, env=None): workspace_dir = tempfile.mkdtemp() @@ -146,18 +143,22 @@ def reconf_lorry(trove_id, workspace_dir): run_git(['commit', '-m', 'New lorry config'], repodir) run_git(['push', 'origin', 'master'], repodir) + trove_id = 'ct-ri-4' project = 'test-proj' repo = 'test-repo' filename = 'test-file' +repopath = "%s/%s/%s" % (trove_id, project, repo) # ssh create_test_project('git@' + trove_id, project) -create_test_repo('git@' + trove_id, project, repo) +create_repo(repopath) can_clone('git@%s:%s/%s/%s' % (trove_id, trove_id, project, repo)) can_push('git@%s:%s/%s/%s' % (trove_id, trove_id, project, repo), repo) +delete_repo(repopath) + # http can_clone('http://%s/git/delta/zip' % trove_id) @@ -169,8 +170,7 @@ except: print("That's great, we're expecting this to fail!") # https -delete_repo(trove_id, project, repo) -create_test_repo('git@' + trove_id, project, repo) +create_repo(repopath) username = 'richardipsum' password = 'quack' @@ -182,3 +182,5 @@ can_clone('https://%s:%s@%s/git/%s/%s/%s' % can_push('https://%s:%s@%s/git/%s/%s/%s' % (username, password, trove_id, trove_id, project, repo), repo, env={'GIT_SSL_NO_VERIFY': '1'}) + +delete_repo(repopath) |