Fix for bam delete test.

This commit is contained in:
2014-11-20 16:34:35 +00:00
parent 4cd2e42d6e
commit 29f1c3778e
2 changed files with 10 additions and 7 deletions

View File

@@ -611,7 +611,10 @@ class BamDeleteTest(BamSessionTestCase):
self.assertEqual("", stderr) self.assertEqual("", stderr)
# now do a real commit # now do a real commit
file_quick_write(session_path, "testfile.txt", file_data) returncode_test = 42
blendfile = os.path.join(session_path, "testfile.blend")
stdout, stderr, returncode = BamBlendTest.create_blend_id(blendfile, "create_blank", returncode_test)
stdout, stderr = bam_run(["commit", "-m", "tests message"], session_path) stdout, stderr = bam_run(["commit", "-m", "tests message"], session_path)
self.assertEqual("", stderr) self.assertEqual("", stderr)
@@ -619,19 +622,18 @@ class BamDeleteTest(BamSessionTestCase):
shutil.rmtree(session_path) shutil.rmtree(session_path)
# checkout the file again # checkout the file again
stdout, stderr = bam_run(["checkout", "testfile.txt"], proj_path) stdout, stderr = bam_run(["checkout", "testfile.blend"], proj_path)
self.assertEqual("", stderr) self.assertEqual("", stderr)
# now delete the file we just checked out # now delete the file we just checked out
new_session_path = os.path.join(proj_path, "testfile") new_session_path = os.path.join(proj_path, "testfile")
run(["rm", os.path.join(new_session_path, "testfile.txt")]) os.remove(os.path.join(new_session_path, "testfile.blend"))
stdout, stderr = bam_run(["commit", "-m", "test deletion"], new_session_path) stdout, stderr = bam_run(["commit", "-m", "test deletion"], new_session_path)
self.assertEqual("", stderr) self.assertEqual("", stderr)
# check if deletion of the file has happened # check if deletion of the file has happened
d = os.path.join(self.path_local_store, "testfile")
stdout, stderr = bam_run(["ls", "--json"], d) stdout, stderr = bam_run(["ls", "--json"], new_session_path)
# check for errors in the response # check for errors in the response
self.assertEqual("", stderr) self.assertEqual("", stderr)

View File

@@ -309,11 +309,12 @@ class FileAPI(Resource):
log.debug(path_ops) log.debug(path_ops)
for file_path, operation in path_ops.items(): for file_path, operation in path_ops.items():
assert(os.path.exists(file_path))
if operation == 'D': if operation == 'D':
file_path_abs = os.path.join(project.repository_path, file_path)
assert(os.path.exists(file_path_abs))
result = local_client.run_command('rm', result = local_client.run_command('rm',
[file_path,]) [file_path_abs,])
# Commit command # Commit command