From fa4af74b282483ba1ba88b6b2e8ad2a39d81e737 Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Mon, 23 Oct 2017 23:02:55 +0200 Subject: verify: Support verifying against None (no entry) --- tests/test_verify.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'tests') diff --git a/tests/test_verify.py b/tests/test_verify.py index e49e98a..5f3e492 100644 --- a/tests/test_verify.py +++ b/tests/test_verify.py @@ -39,6 +39,10 @@ class NonExistingFileVerificationTest(unittest.TestCase): self.assertEqual(gemato.verify.verify_path(os.path.join(self.dir, e.path), e), (True, [])) + def testNone(self): + self.assertEqual(gemato.verify.verify_path(os.path.join(self.dir, 'test'), None), + (True, [])) + class DirectoryVerificationTest(unittest.TestCase): def setUp(self): @@ -65,6 +69,10 @@ class DirectoryVerificationTest(unittest.TestCase): self.assertEqual(gemato.verify.verify_path(self.dir, e), (False, [('__exists__', False, True)])) + def testNone(self): + self.assertEqual(gemato.verify.verify_path(self.dir, None), + (False, [('__exists__', False, True)])) + class CharacterDeviceVerificationTest(unittest.TestCase): def setUp(self): @@ -88,6 +96,10 @@ class CharacterDeviceVerificationTest(unittest.TestCase): self.assertEqual(gemato.verify.verify_path(self.path, e), (False, [('__exists__', False, True)])) + def testNone(self): + self.assertEqual(gemato.verify.verify_path(self.path, None), + (False, [('__exists__', False, True)])) + class NamedPipeVerificationTest(unittest.TestCase): def setUp(self): @@ -117,6 +129,10 @@ class NamedPipeVerificationTest(unittest.TestCase): self.assertEqual(gemato.verify.verify_path(self.path, e), (False, [('__exists__', False, True)])) + def testNone(self): + self.assertEqual(gemato.verify.verify_path(self.path, None), + (False, [('__exists__', False, True)])) + class UNIXSocketVerificationTest(unittest.TestCase): def setUp(self): @@ -149,6 +165,10 @@ class UNIXSocketVerificationTest(unittest.TestCase): self.assertEqual(gemato.verify.verify_path(self.path, e), (False, [('__exists__', False, True)])) + def testNone(self): + self.assertEqual(gemato.verify.verify_path(self.path, None), + (False, [('__exists__', False, True)])) + class EmptyFileVerificationTest(unittest.TestCase): def setUp(self): @@ -217,6 +237,10 @@ class EmptyFileVerificationTest(unittest.TestCase): self.assertEqual(gemato.verify.verify_path(self.path, e), (False, [('__exists__', False, True)])) + def testNone(self): + self.assertEqual(gemato.verify.verify_path(self.path, None), + (False, [('__exists__', False, True)])) + class NonEmptyFileVerificationTest(unittest.TestCase): def setUp(self): @@ -286,6 +310,10 @@ class NonEmptyFileVerificationTest(unittest.TestCase): self.assertEqual(gemato.verify.verify_path(self.path, e), (False, [('__exists__', False, True)])) + def testNone(self): + self.assertEqual(gemato.verify.verify_path(self.path, None), + (False, [('__exists__', False, True)])) + class ProcFileVerificationTest(unittest.TestCase): """ @@ -370,6 +398,10 @@ class ProcFileVerificationTest(unittest.TestCase): self.assertEqual(gemato.verify.verify_path(self.path, e), (False, [('__exists__', False, True)])) + def testNone(self): + self.assertEqual(gemato.verify.verify_path(self.path, None), + (False, [('__exists__', False, True)])) + class ExceptionVerificationTest(object): def setUp(self): @@ -399,3 +431,7 @@ class ExceptionVerificationTest(object): ('DATA', os.path.basename(self.path), '0')) self.assertRaises(gemato.verify.ManifestMismatch, gemato.verify.assert_path_verifies, self.path, e) + + def testNone(self): + self.assertRaises(gemato.verify.ManifestMismatch, + gemato.verify.gemato.verify.assert_path_verifies, self.path, None) -- cgit v1.2.3