From a8b5f4c91b12af9c3a2d84b5da99a71f46c6284d Mon Sep 17 00:00:00 2001 From: Vincent Vinet Date: Fri, 27 Mar 2009 16:08:14 +0000 Subject: Add shells for gobject and gtk parsers in UAM, complete tests --- (limited to 'src/sugar/tutorius/tests') diff --git a/src/sugar/tutorius/tests/uamtests.py b/src/sugar/tutorius/tests/uamtests.py index 5bbebd4..b2a5901 100644 --- a/src/sugar/tutorius/tests/uamtests.py +++ b/src/sugar/tutorius/tests/uamtests.py @@ -18,7 +18,7 @@ import unittest -from sugar.tutorius.uam import parse_uri +from sugar.tutorius.uam import parse_uri, SchemeError PARSE_SUITE={ #URI SCHEME HOST PARAMS PATH QUERY FRAGMENT @@ -28,7 +28,9 @@ PARSE_SUITE={ } class ParseUriTests(unittest.TestCase): + """Tests the UAM parsers""" def test_parse_uri(self): + """Test parsing results""" for uri, test in PARSE_SUITE.items(): res = parse_uri(uri) @@ -39,7 +41,21 @@ class ParseUriTests(unittest.TestCase): assert res.query == test[4], "%s : Expected query %s, got %s" % (uri, test[4], res.query) assert res.fragment == test[5], "%s : Expected fragment %s, got %s" % (uri, test[5], res.fragment) - + def test_errors(self): + """Test exceptions""" + try: + parse_uri("http://something.org/path") + assert False, "Parsing http should fail" + except SchemeError: + pass + + try: + parse_uri("tap.notarealsubscheme://something.org/path") + assert False, "Invalid Subscheme should fail" + except SchemeError: + pass + + if __name__ == "__main__": unittest.main() -- cgit v0.9.1