コード例 #1
0
ファイル: test_pipeline.py プロジェクト: gokulchandrap/solum
 def test_pipelines_post_no_plan(self, PipelineHandler, resp_mock,
                                 request_mock):
     json_create = {'name': 'foo'}
     request_mock.body = json.dumps(json_create)
     request_mock.content_type = 'application/json'
     hand_create = PipelineHandler.return_value.create
     hand_create.return_value = fakes.FakePipeline()
     pipeline.PipelinesController().post()
     ret_val = pipeline.PipelinesController().post()
     faultstring = str(ret_val['faultstring'])
     self.assertIn('The plan was not given or could not be found',
                   faultstring)
     self.assertEqual(400, resp_mock.status)
コード例 #2
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)
コード例 #3
0
ファイル: test_pipeline.py プロジェクト: gokulchandrap/solum
 def test_pipelines_post_nodata(self, PipelineHandler, resp_mock,
                                request_mock):
     request_mock.body = ''
     request_mock.content_type = 'application/json'
     hand_create = PipelineHandler.return_value.create
     hand_create.return_value = fakes.FakePipeline()
     ret_val = pipeline.PipelinesController().post()
     faultstring = str(ret_val['faultstring'])
     self.assertEqual("Missing argument: \"data\"", faultstring)
     self.assertEqual(400, resp_mock.status)
コード例 #4
0
ファイル: test_pipeline.py プロジェクト: gokulchandrap/solum
 def test_pipelines_post_not_hosted(self, PipelineHandler, resp_mock,
                                    request_mock):
     json_create = {'name': 'foo', 'plan_uri': 'http://example.com/a.git'}
     request_mock.body = json.dumps(json_create)
     request_mock.content_type = 'application/json'
     hand_create = PipelineHandler.return_value.create
     hand_create.return_value = fakes.FakePipeline()
     ret_val = pipeline.PipelinesController().post()
     faultstring = str(ret_val['faultstring'])
     self.assertIn('The plan was not hosted in solum', faultstring)
     self.assertEqual(400, resp_mock.status)
コード例 #5
0
ファイル: test_pipeline.py プロジェクト: gokulchandrap/solum
 def test_pipelines_get_all(self, PipelineHandler, resp_mock, request_mock):
     hand_get = PipelineHandler.return_value.get_all
     fake_pipeline = fakes.FakePipeline()
     hand_get.return_value = [fake_pipeline]
     resp = pipeline.PipelinesController().get_all()
     self.assertEqual(fake_pipeline.name, resp['result'][0].name)
     self.assertEqual(fake_pipeline.project_id,
                      resp['result'][0].project_id)
     self.assertEqual(fake_pipeline.uuid, resp['result'][0].uuid)
     self.assertEqual(fake_pipeline.user_id, resp['result'][0].user_id)
     hand_get.assert_called_with()
     self.assertEqual(200, resp_mock.status)
     self.assertIsNotNone(resp)
コード例 #6
0
ファイル: test_pipeline.py プロジェクト: paulczar/solum
    def test_pipelines_post(self, mock_Plan, PipelineHandler,
                            resp_mock, request_mock):
        json_create = {'name': 'foo',
                       'plan_uri': 'http://test_url:8080/test/911'}
        request_mock.body = json.dumps(json_create)
        request_mock.content_type = 'application/json'
        request_mock.security_context = None
        mock_Plan.get_by_uuid.return_value = fakes.FakePlan()

        hand_create = PipelineHandler.return_value.create
        hand_create.return_value = fakes.FakePipeline()
        pipeline.PipelinesController().post()
        hand_create.assert_called_with({'name': 'foo',
                                        'plan_id': 8})
        mock_Plan.get_by_uuid.assert_called_with(None, '911')
        self.assertEqual(201, resp_mock.status)