For what it's worth, I finally came up with a simple working test for
views.  My tests were written correctly all along, I just had to take
care of those errors related to the project settings.  It never
occurred me to just set constants at the top of the test file, but
that's what worked.


import os
from django.test import Client, TestCase

os.environ['MEDIA_LOCATION'] = '/Users/bshaurette/myproject/public'
INTERNAL_IPS = ('127.0.0.1',)

class ViewTests(TestCase):
    def setUp(self):
        self.client = Client()

    def test_login(self):
        response = self.client.post('/accounts/login/', {'username':
'bshaurette', 'password': 'bshaurette'})
        self.assertEqual(response.status_code, 200)

    def tearDown(self):
        self.client.post('/accounts/logout/')


(we have a pattern in the base project urls.py that looks for that env
variable 'MEDIA_LOCATION' as the location for site media ...
hence ... )

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to