summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohan Dahlin <jdahlin@async.com.br>2008-04-08 20:50:46 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-04-08 20:50:46 +0000
commit5f743cddfc05aecf25b9713ae84259d2583b499e (patch)
tree66dfbc41d9afed9908dd28a2cde4fa20e46b1059 /tests
parentb8ab661462d9312f4b723aa25bee8d08c5b46303 (diff)
downloadpygobject-5f743cddfc05aecf25b9713ae84259d2583b499e.tar.gz
Implement GAppInfo constructor, add tests.
2008-04-08 Johan Dahlin <jdahlin@async.com.br> * gio/Makefile.am: * gio/__init__.py: * gio/gappinfo.override: * gio/gio.defs: * gio/gio.override: * tests/test_gio.py: Implement GAppInfo constructor, add tests. svn path=/trunk/; revision=772
Diffstat (limited to 'tests')
-rw-r--r--tests/test_gio.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/tests/test_gio.py b/tests/test_gio.py
index a01e2701..e06cbb02 100644
--- a/tests/test_gio.py
+++ b/tests/test_gio.py
@@ -9,7 +9,7 @@ from common import gio, gobject
class TestFile(unittest.TestCase):
def setUp(self):
self._f = open("file.txt", "w+")
- self.file = gio.file_new_for_path("file.txt")
+ self.file = gio.File("file.txt")
def tearDown(self):
self._f.close()
@@ -54,7 +54,7 @@ class TestFile(unittest.TestCase):
class TestGFileEnumerator(unittest.TestCase):
def setUp(self):
- self.file = gio.file_new_for_path(".")
+ self.file = gio.File(".")
def testEnumerateChildren(self):
enumerator = self.file.enumerate_children(
@@ -186,6 +186,7 @@ class TestOutputStream(unittest.TestCase):
loop = gobject.MainLoop()
loop.run()
+
class TestVolumeMonitor(unittest.TestCase):
def setUp(self):
self.monitor = gio.volume_monitor_get()
@@ -215,16 +216,17 @@ class TestThemedIcon(unittest.TestCase):
self.icon.append_name('close')
self.assertEquals(self.icon.get_names(), ['open', 'close'])
-class TestType(unittest.TestCase):
- def testGuessFromName(self):
+
+class TestContentTypeGuess(unittest.TestCase):
+ def testFromName(self):
mime_type = gio.content_type_guess('diagram.svg')
self.assertEquals('image/svg+xml', mime_type)
- def testGuessFromContents(self):
+ def testFromContents(self):
mime_type = gio.content_type_guess(data='<html></html>')
self.assertEquals('text/html', mime_type)
- def testGuessFromContentsUncertain(self):
+ def testFromContentsUncertain(self):
mime_type, result_uncertain = gio.content_type_guess(
data='<html></html>', want_uncertain=True)
self.assertEquals('text/html', mime_type)
@@ -233,8 +235,16 @@ class TestType(unittest.TestCase):
class TestFileInfo(unittest.TestCase):
def testListAttributes(self):
- gfile = gio.File("test_gio.py")
- fileinfo = gfile.query_info("*")
+ fileinfo = gio.File("test_gio.py").query_info("*")
attributes = fileinfo.list_attributes("standard")
self.failUnless(attributes)
self.failUnless('standard::name' in attributes)
+
+
+class TestAppInfo(unittest.TestCase):
+ def setUp(self):
+ self.appinfo = gio.AppInfo("does-not-exist")
+
+ def testSimple(self):
+ self.assertEquals(self.appinfo.get_description(),
+ "Custom definition for (null)")