Ejemplo n.º 1
0
 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"])
Ejemplo n.º 2
0
 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"])
Ejemplo n.º 3
0
 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"])
Ejemplo n.º 4
0
 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"])
Ejemplo n.º 5
0
 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)
Ejemplo n.º 6
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"])
Ejemplo n.º 7
0
 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)
Ejemplo n.º 8
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"])
Ejemplo n.º 9
0
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
Ejemplo n.º 10
0
 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")))
Ejemplo n.º 11
0
 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")))
Ejemplo n.º 12
0
 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"])
Ejemplo n.º 13
0
def get_plugin_downloader(typename):
    p = Jumble(["../data/plugins"])
    p.load()
    return p.get_plugins(typename=typename)[0]["plugin"]
Ejemplo n.º 14
0
 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")))