Пример #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"])
Пример #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"])
 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"])
Пример #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"])
Пример #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)
Пример #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"])
 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"])
Пример #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
Пример #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")))
Пример #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")))
Пример #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"])
Пример #13
0
def get_plugin_downloader(typename):
    p = Jumble(["../data/plugins"])
    p.load()
    return p.get_plugins(typename=typename)[0]["plugin"]
Пример #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")))