def test_mail_sent_successfully(self): """Tests whether the confirmation email was sent successfully""" self.create_default_role(role_name="Master Admin") response = self.query(register_user_query.format(**self.user_data), ) self.assertEqual(len(mail.outbox), 1) self.assertIn('success', response['data']['createUser'])
def test_register_mutation_user_error(self): """user with the same email already exists""" response = self.query(register_user_query.format(**self.user_data), ) response = self.query(register_user_query.format(**self.user_data), ) self.assertIn('errors', response['data']['createUser'])
def test_create_wrong_email(self): """tests invalid email adress""" self.user_data['email'] = 'usergmail.com' response = self.query(register_user_query.format(**self.user_data), ) self.assertIn('errors', response) self.assertNotIn('success', response)
def test_create_wrong_mobileNumber(self): """tests invalid mobile number""" self.user_data['mobileNumber'] = '2345' response = self.query(register_user_query.format(**self.user_data), ) self.assertIn('errors', response) self.assertNotIn('success', response)
def test_create_wrong_password(self): """tests for a weak password""" self.user_data['password'] = '******' response = self.query(register_user_query.format(**self.user_data), ) self.assertIn('errors', response) self.assertNotIn('success', response)
def test_create_user(self): """method for creating a user""" response = self.query(register_user_query.format(**self.user_data), ) self.assertNotIn('errors', response) self.assertIn('success', response['data']['createUser'])