Exemplo n.º 1
0
    def test_yield_false(self):
        def route_list(_):
            yield False

        callback_route = Route(route_list, route.Route, "", {})
        self.route(callback_route, [], {})
        self.assertFalse(plugin_data["succeeded"])
Exemplo n.º 2
0
    def test_gen(self):
        def route_gen(_):
            yield Listitem.from_dict(callback_test, "test item")

        callback_route = Route(route_gen, route.Route, "", {})
        self.route(callback_route, [], {})
        self.assertTrue(plugin_data["succeeded"])
Exemplo n.º 3
0
    def test_list(self):
        def route_list(_):
            return [Listitem.from_dict(callback_test, "test item")]

        callback_route = Route(route_list, route.Route, "", {})
        self.route(callback_route, [], {})
        self.assertTrue(plugin_data["succeeded"])
Exemplo n.º 4
0
    def test_unsupported_mediatype(self):
        def route_list(_):
            yield Listitem.from_dict(callback_test, "season one", info={"mediatype": "season"})

        callback_route = Route(route_list, route.Route, "", {})
        self.route(callback_route, [], {})
        self.assertTrue(plugin_data["succeeded"])
        self.assertEqual(plugin_data["contenttype"], "files")
Exemplo n.º 5
0
    def test_one_mediatype(self):
        def route_list(_):
            yield Listitem.from_dict(callback_test, "test item", info={"mediatype": "video"})

        callback_route = Route(route_list, route.Route, "", {})
        self.route(callback_route, [], {})
        self.assertTrue(plugin_data["succeeded"])
        self.assertEqual(plugin_data["contenttype"], "videos")
Exemplo n.º 6
0
    def test_no_content(self):
        def route_list(_):
            yield Listitem.from_dict(callback_test, "test item")

        self.route.content_type = None
        callback_route = Route(route_list, route.Route, "", {})
        self.route(callback_route, [], {})
        self.assertTrue(plugin_data["succeeded"])
        self.assertIsNone(plugin_data["contenttype"])
Exemplo n.º 7
0
    def test_sortmethod_genre(self):
        auto_sort.clear()
        del plugin_data["sortmethods"][:]

        def route_list(_):
            yield Listitem.from_dict("http://season one", "test.mkv", info={"genre": "test"})

        callback_route = Route(route_list, route.Route, "", {})
        self.route(callback_route, [], {})
        self.assertTrue(plugin_data["succeeded"])
        self.assertListEqual(plugin_data["sortmethods"], [SORT_UNSORT, SORT_TITLE, SORT_GENRE])
Exemplo n.º 8
0
    def test_custom_sort_with_autosort(self):
        auto_sort.clear()
        del plugin_data["sortmethods"][:]

        def route_list(plugin):
            plugin.add_sort_methods(SORT_DATE)
            yield Listitem.from_dict("http://season one", "test.mkv", info={"genre": "test"})

        callback_route = Route(route_list, route.Route, "", {})
        self.route(callback_route, [], {})
        self.assertTrue(plugin_data["succeeded"])
        self.assertListEqual(plugin_data["sortmethods"], [SORT_DATE, SORT_TITLE, SORT_GENRE])
Exemplo n.º 9
0
    def test_custom_sort_only(self):
        auto_sort.clear()
        del plugin_data["sortmethods"][:]

        def route_list(plugin):
            plugin.add_sort_methods(3, disable_autosort=True)
            yield Listitem.from_dict("http://seasonone.com/works", "test.mkv", info={"genre": "test"})

        callback_route = Route(route_list, route.Route, "", {})
        self.route(callback_route, [], {})
        self.assertTrue(plugin_data["succeeded"])
        self.assertListEqual(plugin_data["sortmethods"], [SORT_DATE])
Exemplo n.º 10
0
    def test_no_sort(self):
        auto_sort.clear()
        del plugin_data["sortmethods"][:]

        def route_list(plugin):
            plugin.autosort = False
            yield Listitem.from_dict("http://season one", "test.mkv")

        callback_route = Route(route_list, route.Route, "", {})
        self.route(callback_route, [], {})
        self.assertTrue(plugin_data["succeeded"])
        self.assertListEqual(plugin_data["sortmethods"], [SORT_UNSORT])
Exemplo n.º 11
0
    def test_sortmethod_date(self):
        auto_sort.clear()
        del plugin_data["sortmethods"][:]

        def route_list(_):
            item = Listitem.from_dict("http://season one", "test.mkv")
            item.info.date("june 27, 2017", "%B %d, %Y")
            yield item

        callback_route = Route(route_list, route.Route, "", {})
        self.route(callback_route, [], {})
        self.assertTrue(plugin_data["succeeded"])
        self.assertListEqual(plugin_data["sortmethods"], [SORT_DATE, SORT_TITLE, SORT_YEAR])
Exemplo n.º 12
0
    def test_custom_sort_override(self):
        auto_sort.clear()
        del plugin_data["sortmethods"][:]

        def route_list(plugin):
            plugin.add_sort_methods(SORT_DATE)
            yield Listitem.from_dict("http://season one", "test.mkv", info={"genre": "test"})
            item = Listitem.from_dict("http://season one", "test.mkv")
            item.info.date("june 27, 2017", "%B %d, %Y")
            yield item

        callback_route = Route(route_list, route.Route, "", {})
        self.route(callback_route, [], {})
        self.assertTrue(plugin_data["succeeded"])
        self.assertListEqual(plugin_data["sortmethods"], [SORT_DATE, SORT_TITLE, SORT_GENRE, SORT_YEAR])