proper delete handling in oauth test client.

This commit is contained in:
Allen Short 2013-04-18 11:42:00 -07:00
Родитель f7ea92d783
Коммит 85b3395cba
1 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -70,8 +70,15 @@ class OAuthClient(Client):
HTTP_AUTHORIZATION=headers.get('Authorization', ''),
**kw)
def delete(self, url, **kw):
url, headers, _ = self.sign('DELETE', self.get_absolute_url(url))
def delete(self, url, data={}, **kw):
if len(url) > 2 and data:
raise RuntimeError('Query string specified both in urlspec and as '
'data arg. Pick one or the other.')
urlstring = self.get_absolute_url(url)
if data:
urlstring = '?'.join([urlstring,
urllib.urlencode(data, doseq=True)])
url, headers, _ = self.sign('DELETE', urlstring)
return super(OAuthClient, self).delete(url,
HTTP_HOST='testserver',
HTTP_AUTHORIZATION=headers.get('Authorization', ''),