예제 #1
0
    def test_get_decypted_password_specific_entry(self):
        store = PasswordStore(self.dir)
        password = '******'
        store.insert_password('hello.com', password)

        # When there is no 'password:'******'ELLO',
            store.get_decypted_password('hello.com', entry=EntryType.password))

        store.insert_password('hello.com', 'sdfsdf\npassword: pwd')
        self.assertEqual(
            'pwd',
            store.get_decypted_password('hello.com', entry=EntryType.password))

        store.insert_password('hello.com', 'sdf\npassword: pwd\nusername: bob')
        self.assertEqual(
            'bob',
            store.get_decypted_password('hello.com', entry=EntryType.username))
예제 #2
0
    def test_encrypt_decrypt(self):
        self.assertFalse(
            os.path.isfile(os.path.join(self.dir, 'hello.com.gpg')))

        store = PasswordStore(self.dir)
        password = '******'
        store.insert_password('hello.com', password)

        self.assertTrue(os.path.isfile(os.path.join(self.dir,
                                                    'hello.com.gpg')))

        self.assertEqual(password, store.get_decypted_password('hello.com'))
예제 #3
0
    def test_get_decypted_password_specific_entry(self):
        store = PasswordStore(self.dir)
        password = '******'
        store.insert_password('hello.com', password)

        # When there is no 'password:'******'ELLO',
            store.get_decypted_password('hello.com', entry=EntryType.password)
        )

        store.insert_password('hello.com', 'sdfsdf\npassword: pwd')
        self.assertEqual(
            'pwd',
            store.get_decypted_password('hello.com', entry=EntryType.password)
        )

        store.insert_password('hello.com', 'sdf\npassword: pwd\nusername: bob')
        self.assertEqual(
            'bob',
            store.get_decypted_password('hello.com', entry=EntryType.username)
        )
예제 #4
0
    def test_encrypt_decrypt(self):
        self.assertFalse(
            os.path.isfile(os.path.join(self.dir, 'hello.com.gpg'))
        )

        store = PasswordStore(self.dir)
        password = '******'
        store.insert_password('hello.com', password)

        self.assertTrue(
            os.path.isfile(os.path.join(self.dir, 'hello.com.gpg'))
        )

        self.assertEqual(
            password,
            store.get_decypted_password('hello.com')
        )