diff options
author | Bhuvan Arumugam <bhuvan@apache.org> | 2012-09-08 23:24:46 -0700 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2012-09-27 22:31:09 +0000 |
commit | 06916aab53a017cc18171d0b4e042865e75e8fce (patch) | |
tree | 7f554bf1383c26cf2f8798d1574d895e95aabdb1 /tests/v2_0 | |
parent | 8ab3c92debf5ce2050158bbf95cbde05c19db908 (diff) | |
download | python-keystoneclient-06916aab53a017cc18171d0b4e042865e75e8fce.tar.gz |
Allow empty description for tenants.
Bug: 1025929
(based on the patch submitted by Ivan Bondarev)
* keystoneclient/v2_0/shell.py
do_tenant_update(): Update description if it is defined.
* keystoneclient/v2_0/tenants.py
Token.update(), TokenManager.update():
Update description if it is defined, even if it's empty.
* tests/v2_0/test_tenants.py
test_update_empty_description(): New test case for empty
description.
Change-Id: I4c4e93f6bd5d38828685fd55eb1e694f521928e9
Diffstat (limited to 'tests/v2_0')
-rw-r--r-- | tests/v2_0/test_tenants.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/v2_0/test_tenants.py b/tests/v2_0/test_tenants.py index bb07f66..78a800f 100644 --- a/tests/v2_0/test_tenants.py +++ b/tests/v2_0/test_tenants.py @@ -218,6 +218,46 @@ class TenantTests(utils.TestCase): self.assertEqual(tenant.description, "I changed you!") self.assertFalse(tenant.enabled) + def test_update_empty_description(self): + req_body = { + "tenant": { + "id": 4, + "name": "tenantX", + "description": "", + "enabled": False, + }, + } + resp_body = { + "tenant": { + "name": "tenantX", + "enabled": False, + "id": 4, + "description": "", + }, + } + resp = httplib2.Response({ + "status": 200, + "body": json.dumps(resp_body), + }) + + httplib2.Http.request(urlparse.urljoin(self.TEST_URL, + 'v2.0/tenants/4'), + 'POST', + body=json.dumps(req_body), + headers=self.TEST_POST_HEADERS) \ + .AndReturn((resp, resp['body'])) + self.mox.ReplayAll() + + tenant = self.client.tenants.update(req_body['tenant']['id'], + req_body['tenant']['name'], + req_body['tenant']['description'], + req_body['tenant']['enabled']) + self.assertTrue(isinstance(tenant, tenants.Tenant)) + self.assertEqual(tenant.id, 4) + self.assertEqual(tenant.name, "tenantX") + self.assertEqual(tenant.description, "") + self.assertFalse(tenant.enabled) + def test_add_user(self): resp = httplib2.Response({ "status": 200, |