def test_set_cookie_max_age(self):
        def check_cookie(status, response_headers):
            assert "200 OK" == status
            assert "Set-Cookie" == response_headers[0][0]
            assert "name=value;max-age=100" == response_headers[0][1]
            return 1

        custom = CustomStartResponse(check_cookie, [])

        custom.set_cookie("name", "value", max_age=100)

        assert 1 == custom("200 OK", [])
  def test_set_cookie_max_age(self):
    def check_cookie(status, response_headers):
      assert "200 OK" == status
      assert "Set-Cookie" == response_headers[0][0]
      assert "name=value;max-age=100" == response_headers[0][1]
      return 1

    custom = CustomStartResponse(check_cookie, [])

    custom.set_cookie("name", "value", max_age=100)

    assert 1 == custom("200 OK", [])
예제 #3
0
    def __call__(self, environ, start_response):
        environ['pythia'] = {
            'jinja_env': EnvironmentWrapper(self.jinja_env),
            'app_settings': self.settings,
        }

        pipeline = Pipeline(self.chain)

        return pipeline(environ, CustomStartResponse(start_response))
  def test_extend(self):
    custom = CustomStartResponse(base)

    custom.add_headers([3, 4])
    
    assert 1 == custom("200 OK", [1, 2])
    def test_init(self):
        custom = CustomStartResponse(base, [3, 4])

        assert 1 == custom("200 OK", [1, 2])
    def test_extend(self):
        custom = CustomStartResponse(base)

        custom.add_headers([3, 4])

        assert 1 == custom("200 OK", [1, 2])
    def test_simple(self):
        custom = CustomStartResponse(base)

        assert 1 == custom("200 OK", [1, 2, 3, 4])