diff options
author | Michał Górny <mgorny@gentoo.org> | 2017-11-02 13:40:24 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2017-11-02 14:53:48 +0100 |
commit | 0ee512648668419a8237fdd397e62a66cfa009c2 (patch) | |
tree | c4e08117958a1e33692a189f8a03bf5074fe13e3 /tests/test_recursiveloader.py | |
parent | cfb1887fefe07d283d3f58c98979e14bf49fdedd (diff) | |
download | gemato-0ee512648668419a8237fdd397e62a66cfa009c2.tar.gz |
recursiveloader: Support setting timestamp
Diffstat (limited to 'tests/test_recursiveloader.py')
-rw-r--r-- | tests/test_recursiveloader.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_recursiveloader.py b/tests/test_recursiveloader.py index 40aeb2b..2835b7f 100644 --- a/tests/test_recursiveloader.py +++ b/tests/test_recursiveloader.py @@ -112,6 +112,17 @@ DATA test 0 MD5 d41d8cd98f00b204e9800998ecf8427e self.assertEqual(m.find_timestamp().ts, datetime.datetime(2017, 1, 1, 1, 1, 1)) + def test_set_timestamp(self): + m = gemato.recursiveloader.ManifestRecursiveLoader( + os.path.join(self.dir, 'Manifest')) + m.set_timestamp(datetime.datetime(2010, 7, 7, 7, 7, 7)) + self.assertEqual(m.find_timestamp().ts, + datetime.datetime(2010, 7, 7, 7, 7, 7)) + self.assertEqual( + len([x for x in m.loaded_manifests['Manifest'].entries + if x.tag == 'TIMESTAMP']), + 1) + def test_find_path_entry(self): m = gemato.recursiveloader.ManifestRecursiveLoader( os.path.join(self.dir, 'Manifest')) @@ -940,6 +951,14 @@ DATA test 0 MD5 d41d8cd98f00b204e9800998ecf8427e self.assertTrue(os.path.exists( os.path.join(self.dir, 'Manifest'))) + def test_set_timestamp(self): + m = gemato.recursiveloader.ManifestRecursiveLoader( + os.path.join(self.dir, 'Manifest')) + self.assertIsNone(m.find_timestamp()) + m.set_timestamp(datetime.datetime(2010, 7, 7, 7, 7, 7)) + self.assertEqual(m.find_timestamp().ts, + datetime.datetime(2010, 7, 7, 7, 7, 7)) + class DuplicateManifestFileEntryTest(TempDirTestCase): """ |