def test_get_credentials_default(self): """Testing HostingServiceAuthForm.get_credentials default behavior""" form = HostingServiceAuthForm( { 'hosting_account_username': '******', 'hosting_account_password': '******', }, hosting_service_cls=TestService) self.assertTrue(form.is_valid()) self.assertEqual(form.get_credentials(), { 'username': '******', 'password': '******', })
def test_get_credentials_default(self): """Testing HostingServiceAuthForm.get_credentials default behavior""" form = HostingServiceAuthForm( { 'hosting_account_username': '******', 'hosting_account_password': '******', }, hosting_service_cls=TestService) self.assertTrue(form.is_valid()) self.assertEqual( form.get_credentials(), { 'username': '******', 'password': '******', })
def test_get_credentials_default_with_2fa_code(self): """Testing HostingServiceAuthForm.get_credentials default behavior with two-factor auth code """ form = HostingServiceAuthForm( { 'hosting_account_username': '******', 'hosting_account_password': '******', 'hosting_account_two_factor_auth_code': '123456', }, hosting_service_cls=TestService) self.assertTrue(form.is_valid()) self.assertEqual( form.get_credentials(), { 'username': '******', 'password': '******', 'two_factor_auth_code': '123456', })
def test_get_credentials_with_form_prefix(self): """Testing HostingServiceAuthForm.get_credentials default behavior with form prefix """ form = HostingServiceAuthForm( { 'myservice-hosting_account_username': '******', 'myservice-hosting_account_password': '******', 'myservice-hosting_account_two_factor_auth_code': '123456', }, hosting_service_cls=TestService, prefix='myservice') self.assertTrue(form.is_valid()) self.assertEqual( form.get_credentials(), { 'username': '******', 'password': '******', 'two_factor_auth_code': '123456', })
def test_get_credentials_default_with_2fa_code(self): """Testing HostingServiceAuthForm.get_credentials default behavior with two-factor auth code """ form = HostingServiceAuthForm( { 'hosting_account_username': '******', 'hosting_account_password': '******', 'hosting_account_two_factor_auth_code': '123456', }, hosting_service_cls=TestService) self.assertTrue(form.is_valid()) self.assertEqual( form.get_credentials(), { 'username': '******', 'password': '******', 'two_factor_auth_code': '123456', })
def test_get_credentials_with_form_prefix(self): """Testing HostingServiceAuthForm.get_credentials default behavior with form prefix """ form = HostingServiceAuthForm( { 'myservice-hosting_account_username': '******', 'myservice-hosting_account_password': '******', 'myservice-hosting_account_two_factor_auth_code': '123456', }, hosting_service_cls=TestService, prefix='myservice') self.assertTrue(form.is_valid()) self.assertEqual( form.get_credentials(), { 'username': '******', 'password': '******', 'two_factor_auth_code': '123456', })