Hi,
I would like to know how I can retrieve the user id of the user
authenticated in the auth subsystem after login in a test.

class CrearCarteraTestCase(TestCase):
        fixtures = ['/fixtures/initial_data.xml']

        def setUp(self):
                self.client = Client()
        
        def testCrearCarteraCorrectamente(self):
                self.client.login(username='pepe', password='test')     
                
                response = self.client.post('/carteras/', {
                        'cartera_nombre':'micartera',
                        'submit':'Crear'
                })
                
                carteras_before = 
Cartera.objects.filter(usuarioID=self.client.user)
                self.assertTemplateUsed(response, 
'Carteras/listado_carteras.html')
                carteras_after = 
Cartera.objects.filter(usuarioID=self.client.user)
                self.assertTrue(len(carteras_after) == len(carteras_before) + 
1)        

What I want to do is test the the "Cartera" (Portfolio) was created
correctly but self.client.user do not exist.
Is this the best way of testing an object creation?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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