Hi all,
i am writing some tests to test a RESTful api i have written (Django 1.3, using piston, python 2.6.5). The url is basically: /api/products and you need to be logged to access it. We can use such api, via curl PUT query (the client code uses pycurl to access the ws). It works in production / development, but not the tests. So far i've tried: 1. send credentials to the web service when doing the PUT request 2. successfully login, and consequentely contact the ws in both cases, the response is an Authorization Required and status code is 401. Btw, i am using follow = True (and so i have a redirect chain with a 301 status). I am pretty sure i am doing something wrong, but can't spot it. Any help ? Thanks in advance, B. N.b.: here is the code i'm using to test: class CommunicationTests(TestCase): """ """ def setUp(self): """ """ admin = User.objects.create_user('admin', 'admin@some','admin') admin.is_staff = True admin.save() self._client = client.Client() self._connected = self._client.login(username="admin", password="admin") def test_contactWS(self): """ """ self.assertTrue(self._connected) credentials = { "username":"admin", "password":"admin" } response = self._client.put(path="/api/products",follow=True, **credentials) Ofc, i am changing very often this code to make tests, not all the scenarios are reported here. P.s.: sorry to the people reading again this mail, sent before to the wrong list. -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.