Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/sugar/tutorius/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/sugar/tutorius/tests')
-rw-r--r--src/sugar/tutorius/tests/uamtests.py20
1 files changed, 18 insertions, 2 deletions
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()