Bind xdgmime in SugarExt

And use it in the sugar3.mime modules. This allows
to get rid of the pygtk generated sugarbase module,
along with the wrapping code.

Also add more cases to test_time to make sure
everything is still working.
This commit is contained in:
Daniel Narvaez
2012-12-09 15:29:45 +01:00
parent e6397cf2db
commit 6202d4d5cc
9 changed files with 65 additions and 223 deletions
+3
View File
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" version="2.0">
</svg>

After

Width:  |  Height:  |  Size: 117 B

+16 -5
View File
@@ -17,12 +17,27 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import os
import unittest
from sugar import mime
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"),
("http://one", "http://two"))
def test_get_mime_parents(self):
self.assertListEqual(mime.get_mime_parents("image/svg+xml"),
["application/xml"])
def test_get_for_file(self):
self.assertEqual(mime.get_for_file(os.path.join(data_dir, "mime.svg")),
'image/svg+xml')
def test_from_file_name(self):
self.assertEqual(mime.get_from_file_name('test.pdf'),
'application/pdf')
@@ -77,7 +92,3 @@ class TestMime(unittest.TestCase):
'text/plain;charset=utf-8', 'text/plain;charset=UTF-8',
'text/plain'])
self.assertEqual(mime_type, 'text/plain')
if __name__ == '__main__':
unittest.main()