diff options
author | Michał Górny <mgorny@gentoo.org> | 2017-10-29 00:25:56 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2017-10-29 00:27:39 +0200 |
commit | f67c7a02467f0e5975905504995f8c599bc323e5 (patch) | |
tree | 3b981c36e1db532afccf6b0c98617ca71938e283 /tests/test_recursiveloader.py | |
parent | 322f503cf5a6af5402c1c55411810a40b4f73cf3 (diff) | |
download | gemato-f67c7a02467f0e5975905504995f8c599bc323e5.tar.gz |
cli: Add an update command
Diffstat (limited to 'tests/test_recursiveloader.py')
-rw-r--r-- | tests/test_recursiveloader.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/test_recursiveloader.py b/tests/test_recursiveloader.py index 498498b..ccab094 100644 --- a/tests/test_recursiveloader.py +++ b/tests/test_recursiveloader.py @@ -501,6 +501,22 @@ DATA test 0 MD5 d41d8cd98f00b204e9800998ecf8427e self.assertNotEqual(f.read(), self.FILES['Manifest']) m.assert_directory_verifies() + def test_cli_update(self): + self.assertEqual( + gemato.cli.main(['gemato', 'update', '--hashes=SHA256 SHA512', + self.dir]), + 0) + # relevant Manifests should have been updated + with io.open(os.path.join(self.dir, 'sub/Manifest'), + 'r', encoding='utf8') as f: + self.assertNotEqual(f.read(), self.FILES['sub/Manifest']) + m = gemato.manifest.ManifestFile() + with io.open(os.path.join(self.dir, 'Manifest'), + 'r', encoding='utf8') as f: + m.load(f) + self.assertNotEqual(m.find_timestamp().ts, + datetime.datetime(2017, 1, 1, 1, 1, 1)) + class MultipleManifestTest(TempDirTestCase): DIRS = ['sub'] @@ -1552,6 +1568,12 @@ DATA sub/version 0 MD5 d41d8cd98f00b204e9800998ecf8427e self.assertRaises(gemato.exceptions.ManifestCrossDevice, m.update_entries_for_directory, '') + def test_cli_update(self): + self.assertEqual( + gemato.cli.main(['gemato', 'update', '--hashes=SHA256 SHA512', + self.dir]), + 1) + class CrossDeviceEmptyManifestTest(TempDirTestCase): """ @@ -1602,6 +1624,12 @@ class CrossDeviceEmptyManifestTest(TempDirTestCase): self.assertRaises(gemato.exceptions.ManifestCrossDevice, m.update_entries_for_directory, '') + def test_cli_update(self): + self.assertEqual( + gemato.cli.main(['gemato', 'update', '--hashes=SHA256 SHA512', + self.dir]), + 1) + class CrossDeviceIgnoreManifestTest(TempDirTestCase): """ @@ -1713,6 +1741,12 @@ DATA test 0 MD5 d41d8cd98f00b204e9800998ecf8427e self.assertRaises(gemato.exceptions.ManifestInvalidPath, m.update_entries_for_directory, '') + def test_cli_update(self): + self.assertEqual( + gemato.cli.main(['gemato', 'update', '--hashes=SHA256 SHA512', + self.dir]), + 1) + class UnreadableDirectoryTest(TempDirTestCase): """ |