-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change-Id: I202f89f74702df6b775d4fa3ca3fca2111709949
- Loading branch information
Showing
2 changed files
with
24 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,32 @@ | ||
#import urlparse | ||
#import json | ||
import urlparse | ||
|
||
#import httplib2 | ||
import httplib2 | ||
|
||
#from keystoneclient.v2_0 import tokens | ||
from tests import utils | ||
|
||
|
||
class TokenTests(utils.TestCase): | ||
def setUp(self): | ||
#super(ServiceTests, 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_create(self): | ||
req_body = {"OS-KSADM:service": {"name": "swift", | ||
"type": "object-store", | ||
"description": "Swift-compatible service."}} | ||
resp_body = {"OS-KSADM:service": {"name": "swift", | ||
"type": "object-store", | ||
"description": "Swift-compatible service.", | ||
"id": 3}} | ||
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": 200, | ||
"body": json.dumps(resp_body), | ||
}) | ||
httplib2.Http.request(urlparse.urljoin(self.TEST_URL, | ||
'v2.0/OS-KSADM/services'), | ||
'POST', | ||
body=json.dumps(req_body), | ||
headers=self.TEST_POST_HEADERS) \ | ||
.AndReturn((resp, resp['body'])) | ||
"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() | ||
|
||
service = self.client.services.create( | ||
req_body['OS-KSADM:service']['name'], | ||
req_body['OS-KSADM:service']['type'], | ||
req_body['OS-KSADM:service']['description']) | ||
self.assertTrue(isinstance(service, services.Service)) | ||
self.assertEqual(service.id, 3) | ||
self.assertEqual(service.name, req_body['OS-KSADM:service']['name']) | ||
''' | ||
self.client.tokens.delete(1) |