Add patch to test

This commit is contained in:
Christian Cueni 2020-05-04 08:48:37 +02:00
parent 268633a81e
commit b7e929e9dd
2 changed files with 3 additions and 3 deletions

View File

@ -36,7 +36,6 @@ class Registration(relay.ClientIDMutation):
try: try:
hep_client.customer_activate(confirmation_key, user_id) hep_client.customer_activate(confirmation_key, user_id)
user_data = hep_client.customers_by_id(admin_token, user_id) user_data = hep_client.customers_by_id(admin_token, user_id)
# double check if user has verified his email. If the "confirmation" field is present, the email address # double check if user has verified his email. If the "confirmation" field is present, the email address
# is not verified. Note that the user should not be able to see this page without verified email. # is not verified. Note that the user should not be able to see this page without verified email.
if 'confirmation' in user_data: if 'confirmation' in user_data:

View File

@ -69,9 +69,10 @@ class RegistrationTests(TestCase):
self.assertTrue(result.get('data').get('registration').get('success')) self.assertTrue(result.get('data').get('registration').get('success'))
self.assertEqual(result.get('data').get('registration').get('message'), 'no_valid_license') self.assertEqual(result.get('data').get('registration').get('message'), 'no_valid_license')
@patch.object(HepClient, 'customers_by_id', return_value=INVALID_KEY_ME)
@patch.object(HepClient, 'customer_activate', return_value="Response") @patch.object(HepClient, 'customer_activate', return_value="Response")
def test_user_cannot_register_with_invalid_key(self, id_mock, confirmation_mock): @patch.object(HepClient, 'customers_by_id', return_value=INVALID_KEY_ME)
@patch.object(HepClient, 'fetch_admin_token', return_value=b'"AABBCCDDEE**44566"')
def test_user_cannot_register_with_invalid_key(self, admin_mock, confirmation_mock, id_mock):
result = self.make_register_mutation('CONFIRMATION_KEY', 1) result = self.make_register_mutation('CONFIRMATION_KEY', 1)