Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/vaulttests.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/vaulttests.py b/tests/vaulttests.py
index d085faf..c6bd852 100644
--- a/tests/vaulttests.py
+++ b/tests/vaulttests.py
@@ -266,18 +266,26 @@ class VaultInterfaceTest(unittest.TestCase):
and return the new resource id. It also test the deletion of the resource.
"""
# Path of an image file in the test folder
- image_path = os.path.join(os.getcwd(), 'tests', 'resources', 'icon.svg')
- assert os.path.isfile(image_path), 'cannot find the test image file'
-
+ test_path = os.path.join(os.getenv("HOME"),".sugar", 'default', 'tutorius', 'tmp')
+ if os.path.isdir(test_path) == True:
+ shutil.rmtree(os.path.join(os.getenv("HOME"),".sugar", 'default', 'tutorius', 'tmp'))
+ os.makedirs(test_path)
+ file_path = os.path.join(test_path, 'test_resource.svg')
+ resource_file = open(file_path, 'wt')
+ resource_file.write('test')
+ resource_file.close()
+ #image_path = os.path.join(os.getcwd(), 'tests', 'resources', 'icon.svg')
+ #assert os.path.isfile(image_path), 'cannot find the test image file'
+
# Create and save a tutorial
- tutorial = Tutorial('test', self.fsm)
+ tutorial = Tutorial('test')
Vault.saveTutorial(tutorial, self.test_metadata_dict)
bundler = TutorialBundler(self.save_test_guid)
tuto_path = bundler.get_tutorial_path(self.save_test_guid)
# add the resource to the tutorial
- resource_id = Vault.add_resource(self.save_test_guid, image_path)
+ resource_id = Vault.add_resource(self.save_test_guid, file_path)
# Check that the image file is now in the vault
assert os.path.isfile(os.path.join(tuto_path, 'resources', resource_id)), 'image file not found in vault'
@@ -288,7 +296,6 @@ class VaultInterfaceTest(unittest.TestCase):
assert os.path.isfile(vault_path), 'path returned is not a file'
basename, extension = os.path.splitext(vault_path)
assert extension == '.svg', 'wrong file path have been returned'
-
# Delete the resource
Vault.delete_resource(self.save_test_guid, resource_id)