def test_prompt_passwords_dont_match(self, mock_display_prompt): secret = vault.PromptVaultSecret(vault_id='test_id', prompt_formats=['Vault password: '******'Confirm Vault password: '******'Passwords do not match', secret.load)
def test_prompt_eoferror(self, mock_display_prompt): secret = vault.PromptVaultSecret(vault_id='test_id') self.assertRaisesRegexp(vault.AnsibleVaultError, 'EOFError.*test_id', secret.load)
def test_custom_prompt(self, mock_display_prompt): secret = vault.PromptVaultSecret( vault_id='test_id', prompt_formats=['The cow flies at midnight: ']) secret.load() self.assertEqual(secret._bytes, b'the_password')
def test_prompt_formats_none(self, mock_display_prompt): secret = vault.PromptVaultSecret(vault_id='test_id') secret.load() self.assertEqual(secret._bytes, b'the_password')
def test_empty_prompt_formats(self): secret = vault.PromptVaultSecret(vault_id='test_id', prompt_formats=[]) secret.load() self.assertIsNone(secret._bytes)
def test_prompt_eoferror(self, mock_display_prompt): secret = vault.PromptVaultSecret(vault_id='test_id') secret.load() self.assertEqual(secret._bytes, None)