예제 #1
0
    def test_last_rating_lower_than_first(self, get_mock):
        get_mock.return_value = MagicMock(ok=True)
        get_mock.return_value.json.return_value = get_api_link(
        ) + "top/anime/1/?page=1"

        stub_list = get_top_anime(1)

        self.assertLess(stub_list[49].rating, stub_list[0].rating)
예제 #2
0
    def test_anime_not_in_top(self, get_mock):
        get_mock.return_value = MagicMock(ok=True)
        get_mock.return_value.json.return_value = get_api_link(
        ) + "top/anime/1/?page=1"

        expected = "one piece"

        self.assertNotIn(expected, get_top_anime(1)[0].name)
예제 #3
0
    def test_anime_in_top(self, get_mock):
        get_mock.return_value = Mock(ok=True)
        get_mock.return_value.json.return_value = get_api_link(
        ) + "top/anime/1/?page=1"

        expected = "Fullmetal"

        self.assertIn(expected, get_top_anime(1)[0].name)
예제 #4
0
    def test_first_rating_higer_than_last(self, get_mock):
        get_mock.return_value = Mock(ok=True)
        get_mock.return_value.json.return_value = get_api_link(
        ) + "top/anime/1/?page=1"

        stub_list = get_top_anime(1)

        self.assertGreater(stub_list[0].rating,
                           stub_list[len(stub_list) - 1].rating)
예제 #5
0
    def test_lowercase(self, mock_get):
        result = "Name: Made in Abyss\nEpisodes: 13"

        mock_get.return_value = Mock(ok=True)
        mock_get.return_value.json.return_value = get_api_link(
        ) + "search/anime?q=made%20in%20abyss&page=1"

        stub = "made in abyss"
        expected = "Name: Made in Abyss\nEpisodes: 13"
        true_result = get_anime_by_name(stub)

        self.assertIn(expected, true_result)
예제 #6
0
    def test_fixed_episodes(self, mock_get):
        result = "Episodes: 11"

        mock_get.return_value = Mock(ok=True)
        mock_get.return_value.json.return_value = get_api_link(
        ) + "search/anime?q=Parasyte&page=1"

        stub = "Ano Hi Mita Hana no Namae wo Bokutachi wa Mada Shiranai"
        expected = "Episodes: 11"
        true_result = get_anime_by_name(stub)

        self.assertIn(expected, true_result)
예제 #7
0
    def test_finished_anime(self, mock_get):
        result = "Is Airing: No"

        mock_get.return_value = Mock(ok=True)
        mock_get.return_value.json.return_value = get_api_link(
        ) + "search/anime?q=Parasyte&page=1"

        stub = "Parasyte"
        expected = "Is Airing: No"
        true_result = get_anime_by_name(stub)

        self.assertIn(expected, true_result)
예제 #8
0
    def test_ongoing_anime(self, mock_get):
        result = "Episodes: 0"

        mock_get.return_value = Mock(ok=True)
        mock_get.return_value.json.return_value = get_api_link(
        ) + "search/anime?q=one%20piece&page=1"

        stub = "One Piece"
        expected = "Episodes: 0"
        true_result = get_anime_by_name(stub)

        self.assertIn(expected, true_result)
예제 #9
0
    def test_negative_top(self, get_mock):
        get_mock.return_value = Mock(ok=False)
        get_mock.return_value.json.return_value = get_api_link(
        ) + "top/anime/1/?page=-1"

        self.assertEqual("error", get_top_anime(-1))