
- 204 No Content should be mocked with empty response bodies - Content-Type headers should not be mocked with empty response bodies - httplib2 would never return None as a response body - The Identity API never expects a req/resp body with a string value of "null" Change-Id: Ie22e8e5288573268165ed06049978195955f8ca6
33 lines
850 B
Python
33 lines
850 B
Python
import urlparse
|
|
|
|
import httplib2
|
|
|
|
from tests import utils
|
|
|
|
|
|
class TokenTests(utils.TestCase):
|
|
def setUp(self):
|
|
super(TokenTests, self).setUp()
|
|
self.TEST_REQUEST_HEADERS = {
|
|
'X-Auth-Token': 'aToken',
|
|
'User-Agent': 'python-keystoneclient'}
|
|
self.TEST_POST_HEADERS = {
|
|
'Content-Type': 'application/json',
|
|
'X-Auth-Token': 'aToken',
|
|
'User-Agent': 'python-keystoneclient'}
|
|
|
|
def test_delete(self):
|
|
resp = httplib2.Response({
|
|
"status": 204,
|
|
"body": ""})
|
|
|
|
req = httplib2.Http.request(
|
|
urlparse.urljoin(self.TEST_URL, 'v2.0/tokens/1'),
|
|
'DELETE',
|
|
headers=self.TEST_REQUEST_HEADERS)
|
|
req.AndReturn((resp, resp['body']))
|
|
|
|
self.mox.ReplayAll()
|
|
|
|
self.client.tokens.delete(1)
|