Example #1
0
 def test_listing_movies_with_unicode_in_title(self):
     """Test listing movies with unicode in the title"""
     responses.add(responses.GET, "http://omdbapi.com/",
                   body=json.dumps(resps[u"WALL·E"]),
                   status=200, content_type="application/json")
     movie = Item("movie", u"WALL·E")
     with mock.patch("__builtin__.raw_input", return_value="y"):
         movie.find(False)
     movie.set_state("have")
     assert(Item.select().where(Item.item_ID == "tt0910970").first())
     print_list("movie", None, None)
Example #2
0
 def test_listing_tv_with_unicode_in_title(self):
     """Test listing TV shows with unicode in the title"""
     responses.add(responses.GET, "http://omdbapi.com/",
                   body=json.dumps(resps[u"Isler Güçler"]),
                   status=200, content_type="application/json")
     show = Item("TV show", u"Isler Güçler")
     with mock.patch("__builtin__.raw_input", return_value="y"):
         show.find(False)
     show.set_state("have")
     assert(Item.select().where(Item.item_ID == "tt2311418").first())
     print_list("TV show", None, None)
Example #3
0
 def test_listing_games(self):
     """Test listing games"""
     responses.add(responses.GET, "http://thegamesdb.net/api/GetGamesList.php",
                   body=base64.b64decode(resps["FIFA 14"]["data"]),
                   status=200, content_type="text/xml")
     game = Item("game", "FIFA 14")
     with mock.patch("__builtin__.raw_input", return_value="16"):
         game.find(False)
     game.set_state("have")
     assert(Item.select().where(Item.item_ID == "18817").first())
     print_list("game", None, None)
Example #4
0
 def test_listing_books(self):
     """Test listing books"""
     responses.add(responses.GET, "https://www.googleapis.com/books/v1/volumes",
                   body=json.dumps(resps["A Game of Thrones"]),
                   status=200, content_type="application/json")
     book = Item("book", "A Item of Thrones")
     with mock.patch("__builtin__.raw_input", return_value="3"):
         book.find(False)
     book.set_state("have")
     assert(Item.select().where(Item.item_ID == "btpIkZ6X6egC").first())
     print_list("book", None, None)
Example #5
0
 def test_listing_tv(self):
     """Test listing TV shows"""
     responses.add(responses.GET, "http://omdbapi.com/",
                   body=json.dumps(resps["The Sopranos"]),
                   status=200, content_type="application/json")
     show = Item("TV show", "The Sopranos")
     with mock.patch("__builtin__.raw_input", return_value="y"):
         show.find(False)
     show.set_state("have")
     assert(Item.select().where(Item.item_ID == "tt0141842").first())
     print_list("TV show", None, None)
Example #6
0
 def test_listing_movies(self):
     """Test listing movies"""
     responses.add(responses.GET, "http://omdbapi.com/",
                   body=json.dumps(resps["The Godfather"]),
                   status=200, content_type="application/json")
     movie = Item("movie", "The Godfather")
     with mock.patch("__builtin__.raw_input", return_value="y"):
         movie.find(False)
     movie.set_state("have")
     assert(Item.select().where(Item.item_ID == "tt0068646").first())
     print_list("movie", None, None)
Example #7
0
 def test_listing_books_with_unicode_in_title(self):
     """Test listing books with unicode in the title"""
     responses.add(responses.GET, "https://www.googleapis.com/books/v1/volumes",
                   body=json.dumps(resps[u"Toda mulher é uma Deusa"]),
                   status=200, content_type="application/json")
     book = Item("book", u"Toda mulher é uma Deusa")
     with mock.patch("__builtin__.raw_input", return_value="1"):
         book.find(False)
     book.set_state("have")
     assert(Item.select().where(Item.item_ID == "NgvTH74c8B0C").first())
     print_list("book", None, None)