diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-03-20 10:31:07 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-03-20 10:31:07 +1300 |
commit | 2739cb4861b5d8b35ab9db0d20128b1bdc5808cb (patch) | |
tree | 04844aa16798308d849f976269708e496d4e2da3 /test/test_utils.py | |
parent | bc3ba4c9930fabe4c0c98b8cd550ad91f878227f (diff) | |
download | mitmproxy-2739cb4861b5d8b35ab9db0d20128b1bdc5808cb.tar.gz mitmproxy-2739cb4861b5d8b35ab9db0d20128b1bdc5808cb.tar.bz2 mitmproxy-2739cb4861b5d8b35ab9db0d20128b1bdc5808cb.zip |
Add a simple parser for content type specifications.
Diffstat (limited to 'test/test_utils.py')
-rw-r--r-- | test/test_utils.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py index 9f07c706..d65fa5b4 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -214,7 +214,18 @@ class u_parse_size(libpry.AutoTree): libpry.raises(ValueError, utils.parse_size, "ak") +class u_parse_content_type(libpry.AutoTree): + def test_simple(self): + p = utils.parse_content_type + assert p("text/html") == ("text", "html", {}) + assert p("text") == None + + v = p("text/html; charset=UTF-8") + assert v == ('text', 'html', {'charset': 'UTF-8'}) + + tests = [ + u_parse_content_type(), uformat_timestamp(), uisBin(), uisXML(), |