コード例 #1
0
    def test_remove_with_corrupted_files(self):
        with TemporaryPocketBookRoot() as ctx:
            entity = Entity()

            key_store = KeyStore(root=ctx.root)
            key_store.add_key('sample', SUPER_SECURE_PASSWORD, entity)

            # corrupt the files
            key_path = key_store._format_key_path('sample')
            self.assertTrue(os.path.isfile(key_path))
            os.remove(key_path)

            with self.assertRaises(RuntimeError):
                key_store.remove_key('sample')
コード例 #2
0
    def test_remove(self):
        with TemporaryPocketBookRoot() as ctx:
            entity = Entity()

            key_store = KeyStore(root=ctx.root)
            key_store.add_key('sample', SUPER_SECURE_PASSWORD, entity)

            self.assertTrue(key_store.remove_key('sample'))
            self.assertNotIn('sample', key_store.list_keys())
コード例 #3
0
    def test_remove_reflected_on_disk(self):
        with TemporaryPocketBookRoot() as ctx:
            entity = Entity()

            key_store = KeyStore(root=ctx.root)
            key_store.add_key('sample', SUPER_SECURE_PASSWORD, entity)

            self.assertTrue(key_store.remove_key('sample'))
            self.assertKeyIsNotPresentOnDisk('sample', ctx)
コード例 #4
0
 def test_remove_failed(self):
     with TemporaryPocketBookRoot() as ctx:
         key_store = KeyStore(root=ctx.root)
         self.assertFalse(key_store.remove_key('sample'))