Merge "Updated service name to be optional in CLI"

This commit is contained in:
Jenkins
2015-01-27 17:59:49 +00:00
committed by Gerrit Code Review
2 changed files with 16 additions and 5 deletions

View File

@@ -269,14 +269,25 @@ class ShellTests(utils.TestCase):
self.run_command('tenant-delete 2')
self.assert_called('DELETE', '/tenants/2')
def test_service_create(self):
def test_service_create_with_required_arguments_only(self):
self.stub_url('POST', ['OS-KSADM', 'services'],
json={'OS-KSADM:service': {}})
self.run_command('service-create --name service1 --type compute')
self.run_command('service-create --type compute')
self.assert_called('POST', '/OS-KSADM/services')
json = {"OS-KSADM:service": {"type": "compute",
"name": None,
"description": None}}
self.assertRequestBodyIs(json=json)
def test_service_create_with_all_arguments(self):
self.stub_url('POST', ['OS-KSADM', 'services'],
json={'OS-KSADM:service': {}})
self.run_command('service-create --type compute '
'--name service1 --description desc1')
self.assert_called('POST', '/OS-KSADM/services')
json = {"OS-KSADM:service": {"type": "compute",
"name": "service1",
"description": None}}
"description": "desc1"}}
self.assertRequestBodyIs(json=json)
def test_service_get(self):

View File

@@ -248,11 +248,11 @@ def do_tenant_delete(kc, args):
kc.tenants.delete(tenant)
@utils.arg('--name', metavar='<name>', required=True,
help='Name of new service (must be unique).')
@utils.arg('--type', metavar='<type>', required=True,
help='Service type (one of: identity, compute, network, '
'image, object-store, or other service identifier string).')
@utils.arg('--name', metavar='<name>',
help='Name of new service (must be unique).')
@utils.arg('--description', metavar='<service-description>',
help='Description of service.')
def do_service_create(kc, args):