コード例 #1
0
    def test_base(self):
        self.middleware = HostnameMiddleware()
        self.request = HttpRequest()
        self.response = HttpResponse()

        self.middleware.process_response(self.request, self.response)
        self.assertEqual(self.response['X-Backend-Server'], 'foobar.oregon-b')
コード例 #2
0
ファイル: test_middleware.py プロジェクト: trigga1/bedrock
    def test_base(self):
        self.middleware = HostnameMiddleware()
        self.request = HttpRequest()
        self.response = HttpResponse()

        self.middleware.process_response(self.request, self.response)
        self.assertEqual(self.response['X-Backend-Server'],
                         'foobar.bedrock-dev.example.com')
コード例 #3
0
    def test_base(self):
        self.middleware = HostnameMiddleware()
        self.request = HttpRequest()
        self.response = HttpResponse()

        self.middleware.process_response(self.request, self.response)
        self.assertEqual(self.response['X-Backend-Server'], 'foobar.bedrock-dev.example.com')
コード例 #4
0
class TestHostnameMiddleware(TestCase):
    @override_settings(HOSTNAME='foobar', DEIS_APP='bedrock-dev', DEIS_DOMAIN='example.com')
    def test_base(self):
        self.middleware = HostnameMiddleware()
        self.request = HttpRequest()
        self.response = HttpResponse()

        self.middleware.process_response(self.request, self.response)
        self.assertEqual(self.response['X-Backend-Server'], 'foobar.bedrock-dev.example.com')

    @override_settings(MIDDLEWARE_CLASSES=(list(settings.MIDDLEWARE_CLASSES) +
                                           ['bedrock.mozorg.middleware.HostnameMiddleware']),
                       HOSTNAME='foobar', DEIS_APP='el-dudarino')
    def test_request(self):
        response = self.client.get('/en-US/')
        self.assertEqual(response['X-Backend-Server'], 'foobar.el-dudarino')
コード例 #5
0
class TestHostnameMiddleware(TestCase):
    @override_settings(HOSTNAME='foobar')
    def test_base(self):
        self.middleware = HostnameMiddleware()
        self.request = HttpRequest()
        self.response = HttpResponse()

        self.middleware.process_response(self.request, self.response)
        self.assertEqual(self.response['X-Backend-Server'], 'foobar')

    @override_settings(MIDDLEWARE_CLASSES=(list(settings.MIDDLEWARE_CLASSES) +
                                           ['bedrock.mozorg.middleware.HostnameMiddleware']),
                       HOSTNAME='foobar')
    def test_request(self):
        response = self.client.get('/en-US/')
        self.assertEqual(response['X-Backend-Server'], 'foobar')
コード例 #6
0
ファイル: test_middleware.py プロジェクト: Delphine/bedrock
    def test_base(self):
        self.middleware = HostnameMiddleware()
        self.request = HttpRequest()
        self.response = HttpResponse()

        self.middleware.process_response(self.request, self.response)
        self.assertEqual(self.response['X-Backend-Server'], 'foobar.oregon-b')
コード例 #7
0
class TestHostnameMiddleware(TestCase):
    @override_settings(HOSTNAME="foobar", CLUSTER_NAME="oregon-b")
    def test_base(self):
        self.middleware = HostnameMiddleware()
        self.request = HttpRequest()
        self.response = HttpResponse()

        self.middleware.process_response(self.request, self.response)
        self.assertEqual(self.response["X-Backend-Server"], "foobar.oregon-b")

    @override_settings(
        MIDDLEWARE=(list(settings.MIDDLEWARE) +
                    ["bedrock.mozorg.middleware.HostnameMiddleware"]),
        HOSTNAME="foobar",
        CLUSTER_NAME="el-dudarino",
    )
    def test_request(self):
        response = self.client.get("/en-US/")
        self.assertEqual(response["X-Backend-Server"], "foobar.el-dudarino")