Fakultas Ilmu Komputer UI

Verified Commit b883c4f2 authored by Giovan Isa Musthofa's avatar Giovan Isa Musthofa
Browse files

[CHORES] Add missing test RegisterFull send_mail side effect

parent 48dc6c0b
Pipeline #43584 passed with stages
in 9 minutes
......@@ -161,6 +161,31 @@ class RegisterFullAPITestCase(APITestCase):
self.assertEqual(user.first_name, data['first_name'])
self.assertEqual(user.profile.id_card_no, data['profile']['id_card_no'])
def test_register_email_sent(self):
user = UserFactory(email='donald@duckduckgo.org', first_name='Donal')
# To dict representation
data = {
k: v
for k, v in user.__dict__.items()
if k in ('email', 'password', 'first_name')
profile_fields = ('body_weight', 'id_card_no', 'birthplace',
'birthdate', 'sex', 'profession', 'blood_type',
'married_status', 'address', 'city', 'district',
'village', 'phone_no', 'work_address', 'work_email',
data['profile'] = {k: v for k, v in user.profile.__dict__.items() if k in profile_fields}
data['password'] = '5up3r_53cuer' # no passwd faker
response = self.client.post('/auth/register-full/', data=data,
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
self.assertEqual(mail.outbox[0].to[0], data['email'])
class AccessTokenAPITestCase(APITestCase):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment