Created
April 25, 2013 17:34
-
-
Save csarcom/5461555 to your computer and use it in GitHub Desktop.
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
import httplib | |
__author__ = 'charles.sartori' | |
from django.contrib.contenttypes.models import ContentType | |
from django.test import TestCase | |
from django.contrib.auth.models import User | |
from mockito import mock, any, when | |
from model_mommy import mommy | |
import reversion | |
from reversion.models import Version, Revision | |
from controlpanel.models import * | |
from cdnsetup.models import * | |
from controlpanel.tests.utils import MockContentType | |
class TestLogin(TestCase): | |
def setUp(self): | |
User.objects.create_user(username='csarcom', password='aaa123') | |
#mommy.make(User, username='csarcom', password='aaa123') | |
self.login = self.client.login(username='csarcom', password='aaa123') | |
def test_login(self): | |
print self.login | |
self.assertTrue(self.login) | |
def test_login_access(self): | |
mommy.make(Services, url_name='ls') | |
data = {'username': 'csarcom', 'password': 'aaa123'} | |
response = self.client.post('/login/', data) | |
# Status Found | |
self.assertEqual(response.status_code, httplib.FOUND) | |
self.assertEqual(response['Location'], 'http://testserver/') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment