Fakultas Ilmu Komputer UI

Commit c6cad1f2 authored by Muhammad Ilham Peruzzi's avatar Muhammad Ilham Peruzzi
Browse files

add test mock message

parent aceba63b
......@@ -93,5 +93,17 @@ class LoginViewTest(TestCase):
self.client.get('/accounts/login?token=abcd123')
self.assertEqual(mock_auth.login.called, False)
@patch('accounts.views.messages')
def test_adds_success_message_with_mocks(self, mock_messages, mock_auth):
response = self.client.post('/accounts/send_login_email', data={
'email': 'edith@example.com'
})
expected = "Check your email, we've sent you a link you can use to log in."
self.assertEqual(
mock_messages.success.call_args,
call(response.wsgi_request, expected),
)
\ No newline at end of file
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