def test_username_ssh_key(self): ct = get_credential_type_from_string('username_ssh_key') self.assertEqual(ct, CredentialType.USERNAME_SSH_KEY)
def test_username_password(self): ct = get_credential_type_from_string('username_password') self.assertEqual(ct, CredentialType.USERNAME_PASSWORD)
def test_snmp(self): ct = get_credential_type_from_string('snmp') self.assertEqual(ct, CredentialType.SNMP)
def test_client_certificate(self): ct = get_credential_type_from_string('client_certificate') self.assertEqual(ct, CredentialType.CLIENT_CERTIFICATE)
def test_none_or_empty_type(self): ct = get_credential_type_from_string(None) self.assertIsNone(ct) ct = get_credential_type_from_string('') self.assertIsNone(ct)
def test_invalid_type(self): with self.assertRaises(InvalidArgument): get_credential_type_from_string('foo')