summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Ipsum <richard.ipsum@codethink.co.uk>2014-02-17 18:23:11 +0000
committerRichard Ipsum <richard.ipsum@codethink.co.uk>2014-02-17 18:23:11 +0000
commit23282afa300099cb67cf93760cf8ca63b636d754 (patch)
treefbed65f9ca019e4458b2f65a5b8c6e3970ff5abb
parent755239fbef2fbcb39974f39127ad2e7d7f0b542f (diff)
downloadsystem-tests-23282afa300099cb67cf93760cf8ca63b636d754.tar.gz
finally the tests for clone, push over http
-rwxr-xr-xtest.py49
1 files changed, 18 insertions, 31 deletions
diff --git a/test.py b/test.py
index 36dab11..d44e84e 100755
--- a/test.py
+++ b/test.py
@@ -54,33 +54,18 @@ def create_test_repo(remote_url, project, repo):
remote_runcmd(remote_url,
['create', "%s/%s/%s" % (trove_id, project, repo)])
-def run_git_clone(trove_id, project, repo, workspace_dir):
- run_git(['clone', 'git@%s:%s/%s/%s'
- % (trove_id, trove_id, project, repo)], workspace_dir)
-
-def run_git_clone_http(vm_name, project, repo, workspace_dir):
- run_git(['clone', 'http://%s/git/%s/%s/%s'
- % (vm_name, vm_name, project, repo)], workspace_dir)
-
-def can_clone(vm_name, project, repo):
+def can_clone(url):
workspace_dir = tempfile.mkdtemp()
- run_git_clone(vm_name, project, repo, workspace_dir)
+ run_git(['clone', url], workspace_dir)
shutil.rmtree(workspace_dir)
-def can_clone_http(vm_name, project, repo):
- workspace_dir = tempfile.mkdtemp()
-
- run_git_clone_http(vm_name, project, repo, workspace_dir)
-
- shutil.rmtree(workspace_dir)
-
-def can_push(vm_name, project, repo):
+def can_push(url, repo):
workspace_dir = tempfile.mkdtemp()
repodir = os.path.join(workspace_dir, repo)
- run_git_clone(vm_name, project, repo, workspace_dir)
+ run_git(['clone', url], workspace_dir)
with open(os.path.join(workspace_dir, repo, filename), 'w') as f:
f.write('A test file')
@@ -125,7 +110,8 @@ def reconf_lorry(trove_id, workspace_dir):
chunk_filename = 'zip.lorry'
lorry_dirname = 'open-source-lorries'
- run_git_clone(trove_id, 'local-config', 'lorries', workspace_dir)
+ run_git(['clone', 'git@%s:%s/local-config/lorries'] % (trove_id, trove_id))
+
repodir = os.path.join(workspace_dir, 'lorries')
run_git(['rm', '-r', '*'], repodir)
@@ -145,21 +131,22 @@ def reconf_lorry(trove_id, workspace_dir):
run_git(['commit', '-m', 'New lorry config'], repodir)
run_git(['push', 'origin', 'master'], repodir)
-vm_name = 'ct-ri-4'
-
+trove_id = 'ct-ri-4'
project = 'test-proj'
repo = 'test-repo'
filename = 'test-file'
-remote_url = 'git@' + vm_name
-create_test_project(remote_url, project)
-create_test_repo(remote_url, project, repo)
+create_test_project('git@' + trove_id, project)
+create_test_repo('git@' + trove_id, project, repo)
-can_clone(vm_name, project, repo)
-can_push(vm_name, project, repo)
+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)
-# TODO: vm_name is trove_id
-can_clone_http(vm_name, project, repo)
-#can_push_http(vm)
+can_clone('http://%s/git/delta/zip' % trove_id)
-can_clone_http('baserock', 'baserock', 'morph') \ No newline at end of file
+# Test that anonymous push gets 403
+# Actually for now we'll just check that git fails
+try:
+ can_push('http://%s/git/delta/zip' % trove_id, 'zip')
+except:
+ print("That's great, we're expecting this to fail!") \ No newline at end of file