コード例 #1
0
    def test_list_latest_movies(self):
        url = 'plugin.video.dreamfilm'
        params = Navigation.encode_parameters({'action': 'latestmovies'})
        argv = [url, 1, params]
        xbmc = Xbmc()
        xbmcplugin = Xbmcplugin()
        xbmcgui = Xbmcgui()
        df = dreamfilm.Dreamfilm()
        with open('fixtures/startpage.html') as f:
            df._latest_movie_html = mock.MagicMock(return_value=f.read())

        navigation = Navigation(df, xbmc, xbmcplugin, xbmcgui, argv)
        navigation.dispatch()

        self.assertEqual(len(xbmcplugin.dir_items), 12)
コード例 #2
0
    def test_search_dispatch(self):
        # Mock
        xbmc = Xbmc()
        xbmcplugin = Xbmcplugin()
        xbmcgui = Xbmcgui()
        xbmc.Keyboard.getText = mock.MagicMock(return_value='bad')
        df = dreamfilm.Dreamfilm()

        with open('fixtures/search.html') as f:
            df._search = mock.MagicMock(return_value=f.read())

        params = Navigation.encode_parameters({'action': 'search'})
        argv = ['plugin.video.dreamfilm', '1', params]
        navigation = Navigation(df, xbmc, xbmcplugin, xbmcgui, argv)
        navigation.dispatch()
        self.assertEqual(len(xbmcplugin.dir_items), 3)