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 = {}
     instance_id = utils.generate_uuid()
     space_id = utils.generate_uuid()
     service = self.service_broker_client.provision(
         instance_id, app['id'], app['plans'][0]['id'],
         space_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({'uri': 'localhost'}, binding)
    def test_provision_with_incorrect_input(self):
        """Test provision with restricted items in object model

        Test will fail on deprovision, if parameters from '?' section
        will passed through service-broker.
        """
        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)

        # NOTE(freerunner): The '?' section should be cutted off during
        # provision action.
        post_json = {
            '?': {
                'type': 'io.murano.apps.{0}'.format(application_name),
                'id': utils.generate_uuid()
            }
        }
        instance_id = utils.generate_uuid()
        space_id = utils.generate_uuid()
        service = self.service_broker_client.provision(
            instance_id, app['id'], app['plans'][0]['id'],
            space_id, post_json)
        self.wait_for_result(instance_id, 30)
        self.addCleanup(self.perform_deprovision, instance_id)
        self.assertIsInstance(json.loads(service), dict)
 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)
    def test_update_package_with_incorrect_id(self):

        post_body = [
            {
                "op": "add",
                "path": "/tags",
                "value": ["im a test"]
            }
        ]

        self.assertRaises(exceptions.NotFound,
                          self.application_catalog_client.update_package,
                          utils.generate_uuid(), post_body)
Example #5
0
 def _get_demo_app():
     return {
         "instance": {
             "assignFloatingIp": "true",
             "keyname": "mykeyname",
             "image": "cloud-fedora-v3",
             "flavor": "m1.medium",
             "?": {"type": "io.murano.resources.LinuxMuranoInstance", "id": "ef984a74-29a4-45c0-b1dc-2ab9f075732e"},
         },
         "name": "orion",
         "port": "8080",
         "?": {"type": "io.murano.apps.apache.Tomcat", "id": utils.generate_uuid()},
     }
Example #6
0
 def _get_demo_app():
     return {
         "instance": {
             "assignFloatingIp": "true",
             "keyname": "mykeyname",
             "image": "cloud-fedora-v3",
             "flavor": "m1.medium",
             "?": {
                 "type": "io.murano.resources.LinuxMuranoInstance",
                 "id": "ef984a74-29a4-45c0-b1dc-2ab9f075732e"
             }
         },
         "name": "orion",
         "port": "8080",
         "?": {
             "type": "io.murano.apps.apache.Tomcat",
             "id": utils.generate_uuid()
         }
     }
 def test_get_status_with_not_present_instance_id(self):
     not_present_instance_id = utils.generate_uuid()
     self.assertRaises(
         exceptions.Gone,
         self.service_broker_client.get_last_status,
         not_present_instance_id)
 def test_get_category_by_incorrect_id(self):
     self.assertRaises(exceptions.NotFound,
                       self.application_catalog_client.get_category,
                       utils.generate_uuid())
 def test_delete_environment_with_wrong_env_id(self):
     self.assertRaises(exceptions.NotFound,
                       self.application_catalog_client.delete_environment,
                       utils.generate_uuid())
 def test_get_ui_definition_with_incorrect_id(self):
     self.assertRaises(exceptions.NotFound,
                       self.application_catalog_client.get_ui_definition,
                       utils.generate_uuid())
 def test_download_package_with_incorrect_id(self):
     self.assertRaises(exceptions.NotFound,
                       self.application_catalog_client.download_package,
                       utils.generate_uuid())
Example #12
0
 def test_delete_category_by_incorrect_id(self):
     self.assertRaises(exceptions.NotFound,
                       self.application_catalog_client.delete_category,
                       utils.generate_uuid())
Example #13
0
 def test_delete_environment_with_wrong_env_id(self):
     self.assertRaises(exceptions.NotFound,
                       self.application_catalog_client.delete_environment,
                       utils.generate_uuid())
Example #14
0
 def test_create_session_before_env(self):
     self.assertRaises(exceptions.NotFound,
                       self.application_catalog_client.create_session,
                       utils.generate_uuid())
 def test_create_session_before_env(self):
     self.assertRaises(exceptions.NotFound,
                       self.application_catalog_client.create_session,
                       utils.generate_uuid())