[PATCH 5/7] tests: Tested the PluginMedia class using GI
- From: Simón Pena <spenap gmail com>
- To: grilo-list gnome org
- Subject: [PATCH 5/7] tests: Tested the PluginMedia class using GI
- Date: Tue, 28 Sep 2010 18:28:30 +0200
---
tests/python/Makefile.am | 3 +-
tests/python/test_plugin.py | 77 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 79 insertions(+), 1 deletions(-)
create mode 100644 tests/python/test_plugin.py
diff --git a/tests/python/Makefile.am b/tests/python/Makefile.am
index b615834..b8ee3ad 100644
--- a/tests/python/Makefile.am
+++ b/tests/python/Makefile.am
@@ -11,7 +11,8 @@ endif
if HAVE_INTROSPECTION
EXTRA_DIST = \
testrunner.py \
- test_registry.py
+ test_registry.py \
+ test_plugin.py
endif
.PHONY: test test-report perf-report full-report
diff --git a/tests/python/test_plugin.py b/tests/python/test_plugin.py
new file mode 100644
index 0000000..1af54cb
--- /dev/null
+++ b/tests/python/test_plugin.py
@@ -0,0 +1,77 @@
+import unittest
+import logging
+
+try:
+ from gi.repository import Grl
+except:
+ logging.warning("Unable to import Grilo's introspection bindings")
+ exit()
+
+class TestMediaPlugin(unittest.TestCase):
+
+ NONEXISTING_KEY = 'nonexisting_key'
+
+ def setUp(self):
+ Grl.init([])
+ self.registry = Grl.PluginRegistry.get_default()
+ self.registry.load_all()
+ sources = self.registry.get_sources(False)
+ if sources:
+ self.plugin = sources[0]
+
+ def tearDown(self):
+ self.plugin = None
+ for source in self.registry.get_sources(False):
+ self.registry.unload(source.get_id())
+ self.registry.unregister_source(source)
+
+ def test_get_name(self):
+ name = self.plugin.get_name()
+ self.assertTrue(name)
+
+ def test_get_description(self):
+ description = self.plugin.get_name()
+ self.assertTrue(description)
+
+ def test_get_version(self):
+ version = self.plugin.get_version()
+ self.assertTrue(version)
+
+ def test_get_license(self):
+ license = self.plugin.get_license()
+ self.assertTrue(license)
+
+ def test_get_author(self):
+ author = self.plugin.get_author()
+ self.assertTrue(author)
+
+ def test_get_site(self):
+ site = self.plugin.get_site()
+ self.assertTrue(site)
+
+ def test_get_id(self):
+ id = self.plugin.get_id()
+ self.assertTrue(id)
+
+ def test_get_filename(self):
+ filename = self.plugin.get_filename()
+ self.assertTrue(filename)
+
+ def test_get_rank(self):
+ rank = self.plugin.get_rank()
+ self.assertTrue(rank is not None)
+
+ def test_get_info_keys(self):
+ info_keys = self.plugin.get_info_keys()
+ self.assertTrue(info_keys)
+
+ def test_get_info_existing_key(self):
+ keys = self.plugin.get_info_keys()
+ if keys:
+ existing_key = keys[0]
+ info = self.plugin.get_info(existing_key)
+ self.assertTrue(info)
+
+ def test_get_info_nonexisting_key(self):
+ info = self.plugin.get_info(self.NONEXISTING_KEY)
+ self.assertFalse(info)
--
1.7.0.4
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]