Commit ace227ad4c841e0d5a2beb17a167415159cfac8d
Committed by
Matheus de Sousa Faria
1 parent
686fe41d
Exists in
master
and in
4 other branches
Testing accounts view
Signed-off-by: TomazMartins <tomaz.r.martins@gmail.com> Signed-off-by: Matheus Faria <matheus.sousa.faria@gmail.com>
Showing
1 changed file
with
27 additions
and
4 deletions
Show diff stats
colab/accounts/tests/test_user.py
@@ -77,10 +77,6 @@ class UserTest(TestCase): | @@ -77,10 +77,6 @@ class UserTest(TestCase): | ||
77 | empty_list = () | 77 | empty_list = () |
78 | self.assertEqual(empty_list, self.user.mailinglists()) | 78 | self.assertEqual(empty_list, self.user.mailinglists()) |
79 | 79 | ||
80 | - def test_update_subscription(self): | ||
81 | - pass | ||
82 | - # TODO: You should have mailman connection. | ||
83 | - | ||
84 | def test_save(self): | 80 | def test_save(self): |
85 | username_test = "USERtestCoLaB" | 81 | username_test = "USERtestCoLaB" |
86 | 82 | ||
@@ -403,3 +399,30 @@ class UserTest(TestCase): | @@ -403,3 +399,30 @@ class UserTest(TestCase): | ||
403 | self.client.post('/account/register', data=data_user) | 399 | self.client.post('/account/register', data=data_user) |
404 | after = User.objects.count() | 400 | after = User.objects.count() |
405 | self.assertEqual(before + 1, after) | 401 | self.assertEqual(before + 1, after) |
402 | + | ||
403 | + def test_user_logged_in_profile(self): | ||
404 | + self.authenticate_user() | ||
405 | + self.client.get("/account/" + self.user.username) | ||
406 | + self.assertEqual(self.client.session['_auth_user_id'], self.user.id) | ||
407 | + | ||
408 | + def test_user_not_logged_in_profile(self): | ||
409 | + self.client.get("/account/" + self.user.username) | ||
410 | + self.assertEqual(self.client.session, {}) | ||
411 | + | ||
412 | + def test_password_changed_message(self): | ||
413 | + self.message_test('Your password was changed.', | ||
414 | + "/account/change-password-done") | ||
415 | + | ||
416 | + def test_password_reset_done_custom_message(self): | ||
417 | + self.message_test("We've emailed you instructions for setting " + | ||
418 | + "your password. You should be receiving them " + | ||
419 | + "shortly.", "/account/password-reset-done/") | ||
420 | + | ||
421 | + def test_password_rest_complete_message(self): | ||
422 | + self.message_test("Your password has been set. You may go ahead and " + | ||
423 | + "log in now.", "/account/password-reset-complete/") | ||
424 | + | ||
425 | + def message_test(self, message, url): | ||
426 | + self.authenticate_user() | ||
427 | + response = self.client.get(url, follow=True) | ||
428 | + self.assertIn(message, response.content) |