def test_get_random(self): p = Jumble(["../data/plugins"]) p.load() source = p.get_plugins(typename="QuotationsPageSource")[0] q = source["plugin"].get_random() self.assertTrue(len(q) > 0) self.assertEqual("TheQuotationsPage.com", q[0]["sourceName"])
def test_get_for_author(self): p = Jumble(["../data/plugins"]) p.load() source = p.get_plugins(typename="GoodreadsSource")[0] q = source["plugin"].get_for_author("Вежинов") self.assertTrue(len(q) > 0) self.assertEqual("Goodreads", q[0]["sourceName"])
def test_get_for_author(self): p = Jumble(["../data/plugins"]) p.load() source = p.get_plugins(typename="GoodreadsSource")[0] q = source["plugin"].get_for_author(u"Вежинов") self.assertTrue(len(q) > 0) self.assertEqual("Goodreads", q[0]["sourceName"])
def test_get_for_keyword(self): p = Jumble(["../data/plugins"]) p.load() source = p.get_plugins(typename="QuotationsPageSource")[0] q = source["plugin"].get_for_keyword("funny") self.assertTrue(len(q) > 0) self.assertEqual("TheQuotationsPage.com", q[0]["sourceName"]) self.assertTrue(q[0]["quote"].lower().find('funny') >= 0)
def test_get_for_author(self): p = Jumble(["../data/plugins"]) p.load() source = p.get_plugins(typename="QuotationsPageSource")[0] q = source["plugin"].get_for_author("voltaire") self.assertTrue(len(q) > 0) self.assertEqual("TheQuotationsPage.com", q[0]["sourceName"]) self.assertEqual("Voltaire", q[0]["author"])
def get_plugin_downloader(typename): p = Jumble(["data/plugins"]) p.load() plugin = p.get_plugins(typename=typename)[0]["plugin"] parent = AttrDict() parent.size_ok = lambda x, y: True plugin.set_variety(parent) return plugin
def test_load(self): p = Jumble(["variety/plugins/builtin"]) p.load() self.assertEqual(14, len(p.get_plugins())) self.assertEqual(14, len(p.get_plugins(IPlugin))) self.assertEqual(1, len(p.get_plugins(name="Goodreads")))
def test_load(self): p = Jumble(["../data/plugins"]) p.load() self.assertEqual(4, len(p.get_plugins())) self.assertEqual(4, len(p.get_plugins(IPlugin))) self.assertEqual(1, len(p.get_plugins(name="Goodreads")))
def test_get_random(self): p = Jumble(["../data/plugins"]) p.load() source = p.get_plugins(typename="QuotesDaddySource")[0] q = source["plugin"].get_random()[0] self.assertEqual("QuotesDaddy", q["sourceName"])
def get_plugin_downloader(typename): p = Jumble(["../data/plugins"]) p.load() return p.get_plugins(typename=typename)[0]["plugin"]