Add binding test for cfapi
- Add test which will check binding route and functional of cfapi service. Change-Id: I958be30ce4fb871a460b37111bd6264f477a5bfb Targets: blueprint murano-cfapi-func-tests
This commit is contained in:
@@ -6,6 +6,11 @@ Name: MockApp
|
||||
|
||||
Extends: std:Application
|
||||
|
||||
Properties:
|
||||
|
||||
userName:
|
||||
Contract: $.string()
|
||||
|
||||
Methods:
|
||||
testAction:
|
||||
Usage: Action
|
||||
|
@@ -92,3 +92,17 @@ class ServiceBrokerClient(rest_client.RestClient):
|
||||
for app in app_list:
|
||||
if app['name'] == name:
|
||||
return app
|
||||
|
||||
def create_binding(self, instance_id):
|
||||
binding_id = utils.generate_uuid()
|
||||
uri = "/v2/service_instances/{0}/service_bindings/{1}".format(
|
||||
instance_id, binding_id)
|
||||
post_body = {
|
||||
"plan_id": utils.generate_uuid(),
|
||||
"service_id": utils.generate_uuid(),
|
||||
"app_guid": utils.generate_uuid()
|
||||
}
|
||||
body = json.dumps(post_body)
|
||||
resp, body = self.put(uri, body, headers=self.headers)
|
||||
self.expected_success([200, 201], resp.status)
|
||||
return self._parse_resp(body)
|
||||
|
@@ -50,3 +50,30 @@ class ServiceBrokerActionsTest(base.BaseServiceBrokerAdminTest):
|
||||
self.wait_for_result(instance_id, 30)
|
||||
self.addCleanup(self.perform_deprovision, instance_id)
|
||||
self.assertIsInstance(json.loads(service), dict)
|
||||
|
||||
@test.attr(type=["smoke", "gate"])
|
||||
def test_binding_instance(self):
|
||||
application_name = utils.generate_name('cfapi')
|
||||
abs_archive_path, dir_with_archive, archive_name = \
|
||||
utils.prepare_package(application_name)
|
||||
self.addCleanup(os.remove, abs_archive_path)
|
||||
package = self.application_catalog_client.upload_package(
|
||||
application_name, archive_name, dir_with_archive,
|
||||
{"categories": [], "tags": [], 'is_public': True})
|
||||
self.addCleanup(self.application_catalog_client.delete_package,
|
||||
package['id'])
|
||||
app_list = self.service_broker_client.get_applications_list()
|
||||
app = self.service_broker_client.get_application(application_name,
|
||||
app_list)
|
||||
post_json = {
|
||||
"userName": application_name
|
||||
}
|
||||
instance_id = utils.generate_uuid()
|
||||
service = self.service_broker_client.provision(
|
||||
instance_id, app['id'], app['plans'][0]['id'], post_json)
|
||||
self.wait_for_result(instance_id, 30)
|
||||
self.addCleanup(self.perform_deprovision, instance_id)
|
||||
self.assertIsInstance(json.loads(service), dict)
|
||||
binding = self.service_broker_client.create_binding(instance_id)
|
||||
self.assertIsInstance(binding, dict)
|
||||
self.assertEqual(application_name, binding['userName'])
|
||||
|
Reference in New Issue
Block a user