diff options
| author | Aldo Cortesi <aldo@nullcube.com> | 2012-02-28 10:55:37 +1300 | 
|---|---|---|
| committer | Aldo Cortesi <aldo@nullcube.com> | 2012-02-28 10:55:37 +1300 | 
| commit | a03e1af7e73af285447c7ecc28f7202a725537e4 (patch) | |
| tree | 61ca8f29220843105ee25d42355cb21f7d78d6e9 /test/test_utils.py | |
| parent | 883424030f2ad7955209ff7b1a55b84e5aa4321c (diff) | |
| parent | 688faa9baa79750642ffbf4241bb166f594e4179 (diff) | |
| download | mitmproxy-a03e1af7e73af285447c7ecc28f7202a725537e4.tar.gz mitmproxy-a03e1af7e73af285447c7ecc28f7202a725537e4.tar.bz2 mitmproxy-a03e1af7e73af285447c7ecc28f7202a725537e4.zip  | |
Merge branch 'upstream-cert'
Diffstat (limited to 'test/test_utils.py')
| -rw-r--r-- | test/test_utils.py | 25 | 
1 files changed, 22 insertions, 3 deletions
diff --git a/test/test_utils.py b/test/test_utils.py index c2f81a7b..79ddf53d 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -149,14 +149,17 @@ class udummy_cert(libpry.AutoTree):          p = utils.dummy_cert(              os.path.join(d, "foo"),              cacert, -            "foo.com" +            "foo.com", +            ["one.com", "two.com", "*.three.com"]          )          assert os.path.exists(p) +                  # Short-circuit          assert utils.dummy_cert(              os.path.join(d, "foo"),              cacert, -            "foo.com" +            "foo.com", +            []          )      def test_no_ca(self): @@ -164,7 +167,8 @@ class udummy_cert(libpry.AutoTree):          p = utils.dummy_cert(              d,              None, -            "foo.com" +            "foo.com", +            []          )          assert os.path.exists(p) @@ -255,7 +259,22 @@ class u_parse_size(libpry.AutoTree):          libpry.raises(ValueError, utils.parse_size, "ak") +class uparse_text_cert(libpry.AutoTree): +    def test_simple(self): +        c = file("data/text_cert", "r").read() +        cn, san = utils.parse_text_cert(c) +        assert cn == "google.com" +        assert len(san) == 436 + +        c = file("data/text_cert_2", "r").read() +        cn, san = utils.parse_text_cert(c) +        assert cn == "www.inode.co.nz" +        assert len(san) == 2 + + +  tests = [ +    uparse_text_cert(),      uformat_timestamp(),      uisBin(),      uisXML(),  | 
