Ejemplo n.º 1
0
  def test_redirect_normalization(self):
    """Test that a page redirect loads correctly with or without a query normalization"""
    capital_party = wikia.page("Communist Party")
    lower_party = wikia.page("communist Party")

    self.assertIsInstance(capital_party, wikia.WikiaPage)
    self.assertIsInstance(lower_party, wikia.WikiaPage)
    self.assertEqual(capital_party.title, "Communist party")
    self.assertEqual(capital_party, lower_party)
Ejemplo n.º 2
0
    def test_redirect_normalization(self):
        """Test that a page redirect loads correctly with or without a query normalization"""
        capital_party = wikia.page("Communist Party")
        lower_party = wikia.page("communist Party")

        self.assertIsInstance(capital_party, wikia.WikiaPage)
        self.assertIsInstance(lower_party, wikia.WikiaPage)
        self.assertEqual(capital_party.title, "Communist party")
        self.assertEqual(capital_party, lower_party)
Ejemplo n.º 3
0
    def test_redirect_true(self):
        """Test that a page successfully redirects a query."""
        # no error should be raised if redirect is test_redirect_true
        mp = wikia.page("Menlo Park, New Jersey")

        self.assertEqual(mp.title, "Edison, New Jersey")
        self.assertEqual(mp.url, "http://en.wikia.org/wiki/Edison,_New_Jersey")
Ejemplo n.º 4
0
  def test_redirect_true(self):
    """Test that a page successfully redirects a query."""
    # no error should be raised if redirect is test_redirect_true
    mp = wikia.page("Menlo Park, New Jersey")

    self.assertEqual(mp.title, "Edison, New Jersey")
    self.assertEqual(mp.url, "http://en.wikia.org/wiki/Edison,_New_Jersey")
Ejemplo n.º 5
0
    async def info(self, ctx, *arg1):
        member = ctx.author
        arg1 = ' '.join(arg1)
        searchword = arg1.title()
        mb = wikia.page("dancingline", str(searchword))
        embed = discord.Embed(title=mb.title,
                              description=mb.content,
                              url=mb.url,
                              colour=member.colour)
        embed.set_author(icon_url=member.avatar_url, name=str(member))
        embed.set_footer(text=self.bot.user.name,
                         icon_url=self.bot.user.avatar_url)
        embed.set_thumbnail(url=ctx.guild.icon_url)
        if mb.images == []:
            pass
        else:
            embed.set_image(url=mb.images[0])

        await ctx.send(content=None, embed=embed)
Ejemplo n.º 6
0
 def test_from_page_id(self):
     """Test loading from a page id"""
     self.assertEqual(self.celtuce, wikia.page(pageid=1868108))
Ejemplo n.º 7
0
 def setUp(self):
     # shortest wikia articles with images and sections
     self.celtuce = wikia.page("Celtuce")
     self.cyclone = wikia.page("Tropical Depression Ten (2005)")
     self.great_wall_of_china = wikia.page("Great Wall of China")
Ejemplo n.º 8
0
 def test_redirect_with_normalization(self):
     """Test that a page redirect with a normalized query loads correctly"""
     the_party = wikia.page("communist Party")
     self.assertIsInstance(the_party, wikia.WikiaPage)
     self.assertEqual(the_party.title, "Communist party")
Ejemplo n.º 9
0
 def test_redirect_false(self):
     """Test that page raises an error on a redirect when redirect == False."""
     mp = lambda: wikia.page("Menlo Park, New Jersey", redirect=False)
     self.assertRaises(wikia.RedirectError, mp)
Ejemplo n.º 10
0
 def test_from_page_id(self):
   """Test loading from a page id"""
   self.assertEqual(self.celtuce, wikia.page(pageid=1868108))
Ejemplo n.º 11
0
 def setUp(self):
   # shortest wikia articles with images and sections
   self.celtuce = wikia.page("Celtuce")
   self.cyclone = wikia.page("Tropical Depression Ten (2005)")
   self.great_wall_of_china = wikia.page("Great Wall of China")
Ejemplo n.º 12
0
 def test_redirect_with_normalization(self):
   """Test that a page redirect with a normalized query loads correctly"""
   the_party = wikia.page("communist Party")
   self.assertIsInstance(the_party, wikia.WikiaPage)
   self.assertEqual(the_party.title, "Communist party")
Ejemplo n.º 13
0
 def test_redirect_false(self):
   """Test that page raises an error on a redirect when redirect == False."""
   mp = lambda: wikia.page("Menlo Park, New Jersey", redirect=False)
   self.assertRaises(wikia.RedirectError, mp)
Ejemplo n.º 14
0
def get_summary(sub_wikia, title):
    page = wikia.page(sub_wikia, title)
    return page.section(page.sections[0])
Ejemplo n.º 15
0
 def test_missing(self):
     """Test that page raises a PageError for a nonexistant page."""
     # Callicarpa?
     purpleberry = lambda: wikia.page("purpleberry")
     self.assertRaises(wikia.PageError, purpleberry)
Ejemplo n.º 16
0
from wikia import wikia

mb = wikia.page("Runescape", "Castle Drakan")

print(mb.title)
print(mb.url)
Ejemplo n.º 17
0
 def test_missing(self):
   """Test that page raises a PageError for a nonexistant page."""
   # Callicarpa?
   purpleberry = lambda: wikia.page("purpleberry")
   self.assertRaises(wikia.PageError, purpleberry)