Exemplo n.º 1
0
class PasswordDatabaseTest(AbstractDatabaseTest):
    def setUp(self):
        self.database_file = 'assets/password.kdbx'
        self.password = '******'
        self.database = Database(self.database_file, password=self.password)

    def test_has_password(self):
        self.assertTrue(self.database.has_password())

    def test_get_password(self):
        self.assertEqual(self.database.get_password(), self.password)

    def test_has_key_file(self):
        self.assertFalse(self.database.has_key_file())

    def test_get_key_file(self):
        self.assertIsNone(self.database.get_key_file())
Exemplo n.º 2
0
class KeyFileDatabaseTest(AbstractDatabaseTest):
    def setUp(self):
        self.database_file = 'assets/keyfile.kdbx'
        self.key_file = 'assets/keyfile.key'
        self.database = Database(self.database_file, key_file=self.key_file)

    def test_has_password(self):
        self.assertFalse(self.database.has_password())

    def test_get_password(self):
        self.assertIsNone(self.database.get_password())

    def test_has_key_file(self):
        self.assertTrue(self.database.has_key_file())

    def test_get_key_file(self):
        self.assertEqual(self.database.get_key_file(),
                         os.path.join(os.getcwd(), self.key_file))
Exemplo n.º 3
0
class PasswordAndKeyFileDatabaseTest(AbstractDatabaseTest):
    def setUp(self):
        self.database_file = 'assets/password_keyfile.kdbx'
        self.password = '******'
        self.key_file = 'assets/password_keyfile.key'
        self.database = Database(self.database_file,
                                 password=self.password,
                                 key_file=self.key_file)

    def test_has_password(self):
        self.assertTrue(self.database.has_password())

    def test_get_password(self):
        self.assertEqual(self.database.get_password(), self.password)

    def test_has_key_file(self):
        self.assertTrue(self.database.has_key_file())

    def test_get_key_file(self):
        self.assertEqual(self.database.get_key_file(),
                         os.path.join(os.getcwd(), self.key_file))