Example #1
0
    def test_set_status_with_reason(self):
        req = self.make_request('GET', '/')
        resp = StreamResponse(req)

        resp.set_status(200, "Everithing is fine!")
        self.assertEqual(200, resp.status)
        self.assertEqual("Everithing is fine!", resp.reason)
Example #2
0
    def test_set_status_with_reason(self):
        resp = StreamResponse()

        resp.set_status(200, "Everithing is fine!")
        self.assertEqual(200, resp.status)
        self.assertEqual("Everithing is fine!", resp.reason)
Example #3
0
def test_set_status_with_reason():
    resp = StreamResponse()

    resp.set_status(200, "Everithing is fine!")
    assert 200 == resp.status
    assert "Everithing is fine!" == resp.reason
Example #4
0
async def test_changing_status_after_prepare_raises():
    resp = StreamResponse()
    await resp.prepare(make_request('GET', '/'))
    with pytest.raises(AssertionError):
        resp.set_status(400)
Example #5
0
def test_changing_status_after_prepare_raises():
    resp = StreamResponse()
    yield from resp.prepare(make_request('GET', '/'))
    with pytest.raises(RuntimeError):
        resp.set_status(400)
Example #6
0
    def test_set_status_with_reason(self):
        resp = StreamResponse()

        resp.set_status(200, "Everithing is fine!")
        self.assertEqual(200, resp.status)
        self.assertEqual("Everithing is fine!", resp.reason)
Example #7
0
def test_changing_status_after_prepare_raises():
    resp = StreamResponse()
    yield from resp.prepare(make_request('GET', '/'))
    with pytest.raises(AssertionError):
        resp.set_status(400)
Example #8
0
def test_set_status_with_reason():
    resp = StreamResponse()

    resp.set_status(200, "Everithing is fine!")
    assert 200 == resp.status
    assert "Everithing is fine!" == resp.reason