예제 #1
0
    def setUp(self):
        super(ApiV1Test, self).setUp()

        # Ensure the v1 API is enabled
        self.config(enable_api_v1=True, group='service:api')

        # Create the application
        self.app = api_v1.factory({})

        # Inject the NormalizeURIMiddleware middleware
        self.app.wsgi_app = middleware.NormalizeURIMiddleware(
            self.app.wsgi_app)

        # Inject the FaultWrapper middleware
        self.app.wsgi_app = middleware.FaultWrapperMiddleware(
            self.app.wsgi_app)

        # Inject the ValidationError middleware
        self.app.wsgi_app = middleware.APIv1ValidationErrorMiddleware(
            self.app.wsgi_app)

        # Inject the TestAuth middleware
        self.app.wsgi_app = middleware.TestContextMiddleware(
            self.app.wsgi_app, self.admin_context.tenant,
            self.admin_context.user)

        # Obtain a test client
        self.client = self.app.test_client()
예제 #2
0
파일: __init__.py 프로젝트: bias/designate
    def setUp(self):
        super(ApiV1Test, self).setUp()

        # Ensure the v1 API is enabled
        self.config(enable_api_v1=True, group="service:api")

        # Create the application
        self.app = api_v1.factory({})

        # Inject the NormalizeURIMiddleware middleware
        self.app.wsgi_app = middleware.NormalizeURIMiddleware(self.app.wsgi_app)

        # Inject the FaultWrapper middleware
        self.app.wsgi_app = middleware.FaultWrapperMiddleware(self.app.wsgi_app)

        # Inject the ValidationError middleware
        self.app.wsgi_app = middleware.APIv1ValidationErrorMiddleware(self.app.wsgi_app)

        # Inject the TestAuth middleware
        self.app.wsgi_app = middleware.TestContextMiddleware(
            self.app.wsgi_app, self.admin_context.tenant, self.admin_context.user
        )

        # Obtain a test client
        self.client = self.app.test_client()
예제 #3
0
    def setUp(self):
        super(ApiV1Test, self).setUp()

        # Create a Flask application
        self.app = api_v1.factory({})

        # Inject the FaultWrapper middleware
        self.app.wsgi_app = api_v1.FaultWrapperMiddleware(self.app.wsgi_app)

        # Inject the NoAuth middleware
        self.app.wsgi_app = middleware.NoAuthContextMiddleware(
            self.app.wsgi_app)

        # Obtain a test client
        self.client = self.app.test_client()

        # Create and start an instance of the central service
        self.central_service = self.get_central_service()
        self.central_service.start()
예제 #4
0
    def setUp(self):
        super(ApiV1Test, self).setUp()

        # Ensure the v1 API is enabled
        self.config(enable_api_v1=True, group='service:api')

        # Create the application
        self.app = api_v1.factory({})

        # Inject the FaultWrapper middleware
        self.app.wsgi_app = middleware.FaultWrapperMiddleware(
            self.app.wsgi_app)

        # Inject the NoAuth middleware
        self.app.wsgi_app = middleware.NoAuthContextMiddleware(
            self.app.wsgi_app)

        # Obtain a test client
        self.client = self.app.test_client()

        self.central_service = self.start_service('central')
예제 #5
0
    def setUp(self):
        super(ApiV1Test, self).setUp()

        # Ensure the v1 API is enabled
        self.config(enable_api_v1=True, group='service:api')

        # Create the application
        self.app = api_v1.factory({})

        # Inject the FaultWrapper middleware
        self.app.wsgi_app = middleware.FaultWrapperMiddleware(
            self.app.wsgi_app)

        # Inject the TestAuth middleware
        self.app.wsgi_app = middleware.TestContextMiddleware(
            self.app.wsgi_app, self.admin_context.tenant_id,
            self.admin_context.user_id)

        # Obtain a test client
        self.client = self.app.test_client()

        self.central_service = self.start_service('central')
예제 #6
0
    def setUp(self):
        super(ApiV1Test, self).setUp()

        # Ensure the v1 API is enabled
        self.config(enable_api_v1=True, group='service:api')

        # Create the application
        self.app = api_v1.factory({})

        # Inject the FaultWrapper middleware
        self.app.wsgi_app = middleware.FaultWrapperMiddleware(
            self.app.wsgi_app)

        # Inject the NoAuth middleware
        self.app.wsgi_app = middleware.NoAuthContextMiddleware(
            self.app.wsgi_app)

        # Obtain a test client
        self.client = self.app.test_client()

        # Create and start an instance of the central service
        self.central_service = self.get_central_service()
        self.central_service.start()