Exemple #1
0
class Controller(object):
    """Version 1 API controller root."""

    plans = plan.PlansController()
    assemblies = assembly.AssembliesController()
    services = service.ServicesController()
    components = component.ComponentsController()
    extensions = extension.ExtensionsController()
    operations = operation.OperationsController()
    sensors = sensor.SensorsController()
    language_packs = language_pack.LanguagePacksController()
    pipelines = pipeline.PipelinesController()
    public = public.PublicController()
    infrastructure = infrastructure.InfrastructureController()

    @exception.wrap_wsme_controller_exception
    @wsme_pecan.wsexpose(Platform)
    def index(self):
        host_url = '%s/%s' % (pecan.request.host_url, 'v1')
        return Platform(uri=host_url,
                        name='solum',
                        type='platform',
                        description='solum native implementation',
                        implementation_version=version.version_string(),
                        plans_uri='%s/plans' % host_url,
                        assemblies_uri='%s/assemblies' % host_url,
                        services_uri='%s/services' % host_url,
                        components_uri='%s/components' % host_url,
                        extensions_uri='%s/extensions' % host_url,
                        language_packs_uri='%s/language_packs' % host_url)
Exemple #2
0
 def test_extensions_post_nodata(self, handler_mock, resp_mock,
                                 request_mock):
     request_mock.body = ''
     request_mock.content_type = 'application/json'
     handler_create = handler_mock.return_value.create
     handler_create.return_value = fakes.FakeExtension()
     ret_val = controller.ExtensionsController().post()
     self.assertEqual("Missing argument: \"data\"",
                      str(ret_val['faultstring']))
     self.assertEqual(400, resp_mock.status)
Exemple #3
0
 def test_extensions_post(self, handler_mock, resp_mock, request_mock):
     json_update = {
         'name': 'foo',
         'description': 'foofoo',
         'user_id': 'user_id_test',
         'project_id': 'project_id_test',
         'version': '1.3'
     }
     request_mock.body = json.dumps(json_update)
     request_mock.content_type = 'application/json'
     handler_create = handler_mock.return_value.create
     handler_create.return_value = fakes.FakeExtension()
     obj = controller.ExtensionsController()
     obj.post(fakes.FakeExtension())
     self.assertEqual(201, resp_mock.status)
     handler_create.assert_called_once_with(json_update)
Exemple #4
0
 def test_extensions_get_all(self, handler_mock, resp_mock, request_mock):
     hand_get_all = handler_mock.return_value.get_all
     fake_extension = fakes.FakeExtension()
     hand_get_all.return_value = [fake_extension]
     obj = controller.ExtensionsController()
     resp = obj.get_all()
     self.assertIsNotNone(resp)
     self.assertEqual(fake_extension.name, resp['result'][0].name)
     self.assertEqual(fake_extension.documentation,
                      resp['result'][0].documentation)
     self.assertEqual(fake_extension.description,
                      resp['result'][0].description)
     self.assertEqual(fake_extension.project_id,
                      resp['result'][0].project_id)
     self.assertEqual(fake_extension.uuid, resp['result'][0].uuid)
     self.assertEqual(fake_extension.version, resp['result'][0].version)
     hand_get_all.assert_called_with()
     self.assertEqual(200, resp_mock.status)
Exemple #5
0
 def test_extensions_get_all(self, resp_mock, request_mock):
     extension_obj = extension.ExtensionsController()
     resp = extension_obj.get_all()
     self.assertIsNotNone(resp)
     self.assertEqual(200, resp_mock.status)