Created
March 27, 2012 17:41
-
-
Save gilsondev/2218279 to your computer and use it in GitHub Desktop.
Unit test for views with decoration @login_required
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf8 -*- | |
from django.test import TestCase | |
from django.core.urlresolvers import reverse | |
class ProfileViewTest(TestCase): | |
"""Unit test for verify profile views""" | |
fixtures = ['users.json'] | |
def setUp(self): | |
self.response = self.client.login(username='john', | |
password='123456') | |
def test_profile_form_success(self): | |
self.response = self.client.get(reverse('clients:profile')) | |
self.assertTrue(200, self.response.status_code) | |
self.assertTemplateUsed(self.response, 'clients/profile_form.html') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"pk": 2, | |
"model": "auth.user", | |
"fields": { | |
"username": "john", | |
"first_name": "John", | |
"last_name": "Michael", | |
"is_active": true, | |
"is_superuser": false, | |
"is_staff": false, | |
"last_login": "2012-03-27 14:23:28", | |
"groups": [], | |
"user_permissions": [], | |
"password": "sha1$250a8$cd1b6de868bb32e22fecc358ccd5b4cf6154e1ea", | |
"email": "[email protected]", | |
"date_joined": "2012-03-27 14:22:53" | |
} | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment