I'm new to Django and am running a test.
For my admintest in tests.py, I have the following:
--------------
class AdminTest(LiveServerTestCase):
def test_login(self):
c = Client()
response = c.get('/admin/')
self.assertEquals(response.status_code,200)
self.assertTrue('Log in' in response.content)
c.login(username = 'username',password='password')
response = c.get('/admin/')
self.assertEquals(response.status_code,200)
self.assertTrue('Log out' in response.content)
-------------
And I get this error.
-------------
$ python manage.py test
Creating test database for alias 'default'...
.F
======================================================================
FAIL: test_login (blogengine.tests.AdminTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/Desktop/Python/1.7/src/blogengine/tests.py", line 35, in test_login
self.assertEquals(response.status_code,200)
AssertionError: 302 != 200
----------------------------------------------------------------------
Ran 2 tests in 0.510s
FAILED (failures=1)
Destroying test database for alias 'default'...
-------------
Since I checked the admin is actually working(status 200) in my localhost, I thought I should give 200 status instead of 302.
Please give me some advice to fix this.
Many thanks,
Kim