()
| 437 | |
| 438 | |
| 439 | def test_response_cookies(): |
| 440 | resp = StreamResponse() |
| 441 | |
| 442 | assert resp.cookies == {} |
| 443 | assert str(resp.cookies) == '' |
| 444 | |
| 445 | resp.set_cookie('name', 'value') |
| 446 | assert str(resp.cookies) == 'Set-Cookie: name=value; Path=/' |
| 447 | resp.set_cookie('name', 'other_value') |
| 448 | assert str(resp.cookies) == 'Set-Cookie: name=other_value; Path=/' |
| 449 | |
| 450 | resp.cookies['name'] = 'another_other_value' |
| 451 | resp.cookies['name']['max-age'] = 10 |
| 452 | assert (str(resp.cookies) == |
| 453 | 'Set-Cookie: name=another_other_value; Max-Age=10; Path=/') |
| 454 | |
| 455 | resp.del_cookie('name') |
| 456 | expected = 'Set-Cookie: name=("")?; Max-Age=0; Path=/' |
| 457 | assert re.match(expected, str(resp.cookies)) |
| 458 | |
| 459 | resp.set_cookie('name', 'value', domain='local.host') |
| 460 | expected = 'Set-Cookie: name=value; Domain=local.host; Path=/' |
| 461 | assert str(resp.cookies) == expected |
| 462 | |
| 463 | |
| 464 | def test_response_cookie_path(): |
nothing calls this directly
no test coverage detected