Skip to content

Commit

Permalink
Add test for add and delete in app repository
Browse files Browse the repository at this point in the history
  • Loading branch information
thrau committed Oct 25, 2020
1 parent 4073098 commit b973da2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/apps/test_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

from galileo.apps.repository import Repository

this_dir = os.path.join(os.path.dirname(__file__))


class TemporaryRepositoryResource:
"""
Expand Down Expand Up @@ -83,6 +85,27 @@ def test_get_app_without_manifestreturns_none(self):
info = self.repo.repository.get_app('nomanifest')
self.assertIsNone(info)

def test_add_and_get(self):
repo = self.repo.repository
info = repo.add(os.path.join(this_dir, 'testapp2.zip'))

self.assertEqual('testapp2', info.name)
self.assertEqual({'name': 'testapp2'}, info.manifest)

actual = repo.get_app('testapp2')
self.assertEqual(info, actual)

def test_add_and_remove(self):
repo = self.repo.repository
info = repo.add(os.path.join(this_dir, 'testapp2.zip'))

self.assertTrue(os.path.isfile(info.archive_path))

deleted = repo.delete_app('testapp2')
self.assertTrue(deleted)

self.assertFalse(os.path.isfile(info.archive_path))


if __name__ == '__main__':
unittest.main()
Binary file added tests/apps/testapp2.zip
Binary file not shown.

0 comments on commit b973da2

Please sign in to comment.