File: test_cookies_bw.py

package info (click to toggle)
python-webob 1%3A1.8.5-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,664 kB
  • sloc: python: 21,344; makefile: 171
file content (21 lines) | stat: -rw-r--r-- 566 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import warnings

from webob import cookies

def setup_module(module):
    cookies._should_raise = False

def teardown_module(module):
    cookies._should_raise = False

def test_invalid_cookie_space():
    with warnings.catch_warnings(record=True) as w:
        # Cause all warnings to always be triggered.
        warnings.simplefilter("always")

        # Trigger a warning.
        cookies._value_quote(b'hello world')

        assert len(w) == 1
        assert issubclass(w[-1].category, RuntimeWarning) is True
        assert "ValueError" in str(w[-1].message)