|
|
|
@ -25,6 +25,7 @@ from sugar3 import mime
|
|
|
|
|
tests_dir = os.path.dirname(__file__)
|
|
|
|
|
data_dir = os.path.join(tests_dir, "data")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestMime(unittest.TestCase):
|
|
|
|
|
def test_split_uri_list(self):
|
|
|
|
|
self.assertSequenceEqual(mime.split_uri_list("http://one\nhttp://two"),
|
|
|
|
@ -51,8 +52,12 @@ class TestMime(unittest.TestCase):
|
|
|
|
|
|
|
|
|
|
# Mozilla's text in c&v
|
|
|
|
|
mime_type = mime.choose_most_significant(
|
|
|
|
|
['text/_moz_htmlcontext', 'STRING', 'text/html',
|
|
|
|
|
'text/_moz_htmlinfo', 'text/x-moz-url-priv', 'UTF8_STRING',
|
|
|
|
|
['text/_moz_htmlcontext',
|
|
|
|
|
'STRING',
|
|
|
|
|
'text/html',
|
|
|
|
|
'text/_moz_htmlinfo',
|
|
|
|
|
'text/x-moz-url-priv',
|
|
|
|
|
'UTF8_STRING',
|
|
|
|
|
'COMPOUND_TEXT'])
|
|
|
|
|
self.assertEqual(mime_type, 'text/html')
|
|
|
|
|
|
|
|
|
@ -67,9 +72,15 @@ class TestMime(unittest.TestCase):
|
|
|
|
|
|
|
|
|
|
# Mozilla url in dnd
|
|
|
|
|
mime_type = mime.choose_most_significant(
|
|
|
|
|
['text/_moz_htmlcontext', 'text/html', 'text/_moz_htmlinfo',
|
|
|
|
|
'_NETSCAPE_URL', 'text/x-moz-url', 'text/x-moz-url-desc',
|
|
|
|
|
'text/x-moz-url-data', 'text/plain', 'text/unicode'])
|
|
|
|
|
['text/_moz_htmlcontext',
|
|
|
|
|
'text/html',
|
|
|
|
|
'text/_moz_htmlinfo',
|
|
|
|
|
'_NETSCAPE_URL',
|
|
|
|
|
'text/x-moz-url',
|
|
|
|
|
'text/x-moz-url-desc',
|
|
|
|
|
'text/x-moz-url-data',
|
|
|
|
|
'text/plain',
|
|
|
|
|
'text/unicode'])
|
|
|
|
|
self.assertEqual(mime_type, 'text/x-moz-url')
|
|
|
|
|
|
|
|
|
|
# Abiword text in dnd
|
|
|
|
|