Пример #1
0
    def test_can_get_handlers_with_blacklist(self):
        ctx = self.get_context()
        ctx.config.UPLOAD_ENABLED = False
        ctx.config.USE_BLACKLIST = True
        app = ThumborServiceApp(ctx)

        handlers = app.get_handlers()
        expect(handlers).to_length(3)
Пример #2
0
    def test_can_get_handlers_with_blacklist(self):
        ctx = mock.Mock(config=mock.Mock(
            UPLOAD_ENABLED=False,
            USE_BLACKLIST=True,
        ))
        app = ThumborServiceApp(ctx)

        handlers = app.get_handlers()
        expect(handlers).to_length(3)
Пример #3
0
    def test_can_get_handlers_with_blacklist(self):
        ctx = mock.Mock(
            config=mock.Mock(
                UPLOAD_ENABLED=False,
                USE_BLACKLIST=True,
            )
        )
        app = ThumborServiceApp(ctx)

        handlers = app.get_handlers()
        expect(handlers).to_length(3)
Пример #4
0
    def test_can_get_handlers(self):
        ctx = self.get_context()
        ctx.config.UPLOAD_ENABLED = False
        ctx.config.USE_BLACKLIST = False
        ctx.config.HEALTHCHECK_ROUTE = "/health"
        app = ThumborServiceApp(ctx)

        handlers = app.get_handlers()
        expect(handlers).to_length(2)
        expect(handlers[0][0]).to_equal(r"/health")
        expect(handlers[1][0]).to_equal(Url.regex())
Пример #5
0
    def get_handlers(self):
        handlers = ThumborServiceApp.get_handlers(self)

        # Remove the default image handler
        handlers.pop()

        # Then install our own image handler
        handlers.append((Url.regex(), RewriteHandler, {
            'context': self.context
        }))
        return handlers
Пример #6
0
    def test_can_get_handlers(self):
        ctx = mock.Mock(config=mock.Mock(
            UPLOAD_ENABLED=False,
            USE_BLACKLIST=False,
        ))
        app = ThumborServiceApp(ctx)

        handlers = app.get_handlers()
        expect(handlers).to_length(2)
        expect(handlers[0][0]).to_equal(r'/healthcheck')
        expect(handlers[1][0]).to_equal(Url.regex())
Пример #7
0
    def test_can_get_handlers(self):
        ctx = mock.Mock(
            config=mock.Mock(
                UPLOAD_ENABLED=False,
                USE_BLACKLIST=False,
            )
        )
        app = ThumborServiceApp(ctx)

        handlers = app.get_handlers()
        expect(handlers).to_length(2)
        expect(handlers[0][0]).to_equal(r'/healthcheck')
        expect(handlers[1][0]).to_equal(Url.regex())