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))
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'))
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) )
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') )