Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ script:
- msgcmp resources/language/resource.language.{nl_nl,en_gb}/strings.po
#- kodi-addon-checker . --branch=krypton
#- kodi-addon-checker . --branch=leia
- proxy.py &
- coverage run -m unittest discover
- coverage run -a test/run.py /

Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@ addon: clean
kodi-addon-checker . --branch=krypton
kodi-addon-checker . --branch=leia

unit:
unit: clean
@echo -e "$(white)=$(blue) Starting unit tests$(reset)"
-pkill -ef proxy.py
proxy.py &
python -m unittest discover
pkill -ef proxy.py

run:
@echo -e "$(white)=$(blue) Run CLI$(reset)"
Expand All @@ -61,6 +64,7 @@ zip: clean

clean:
find . -name '*.pyc' -type f -delete
find . -name '*.pyo' -type f -delete
find . -name '__pycache__' -type d -delete
rm -rf .pytest_cache/ .tox/
rm -f *.log test/userdata/tokens/*.tkn
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ codecov
git+git://github.com/emilsvennesson/script.module.inputstreamhelper.git@master#egg=inputstreamhelper
kodi-addon-checker
polib
proxy.py
python-dateutil
pylint
git+git://github.com/dagwieers/kodi-plugin-routing.git@setup#egg=routing
Expand Down
57 changes: 57 additions & 0 deletions test/test_proxy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Dag Wieers (@dagwieers) <dag@wieers.com>
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

# pylint: disable=duplicate-code,invalid-name,missing-docstring,protected-access

from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
import addon

xbmc = __import__('xbmc')
xbmcaddon = __import__('xbmcaddon')
xbmcgui = __import__('xbmcgui')
xbmcvfs = __import__('xbmcvfs')

plugin = addon.plugin


class TestProxy(unittest.TestCase):
def setUp(self):
xbmc.GLOBAL_SETTINGS['network.usehttpproxy'] = True
xbmc.GLOBAL_SETTINGS['network.httpproxytype'] = 0
xbmc.GLOBAL_SETTINGS['network.httpproxyserver'] = '127.0.0.1'
xbmc.GLOBAL_SETTINGS['network.httpproxyport'] = '8899'

def tearDown(self):
xbmc.GLOBAL_SETTINGS['network.usehttpproxy'] = False

# Delete tokens method: '/tokens/delete'
def test_clear_cookies_route(self):
plugin.run(['plugin://plugin.video.vrt.nu/tokens/delete', '0', ''])
self.assertEqual(plugin.url_for(addon.delete_tokens), 'plugin://plugin.video.vrt.nu/tokens/delete')

# Delete cache method: '/cache/delete'
def test_invalidate_caches_route(self):
plugin.run(['plugin://plugin.video.vrt.nu/cache/delete', '0', ''])
self.assertEqual(plugin.url_for(addon.delete_cache), 'plugin://plugin.video.vrt.nu/cache/delete')

# A-Z menu: '/programs'
def test_az_menu(self):
plugin.run(['plugin://plugin.video.vrt.nu/programs', '0', ''])
self.assertEqual(plugin.url_for(addon.programs), 'plugin://plugin.video.vrt.nu/programs')

# Categories menu: '/categories'
def test_categories_menu(self):
plugin.run(['plugin://plugin.video.vrt.nu/categories', '0', ''])
self.assertEqual(plugin.url_for(addon.categories), 'plugin://plugin.video.vrt.nu/categories')

# Categories programs menu: '/categories/<category>'
def test_categories_tvshow_menu(self):
plugin.run(['plugin://plugin.video.vrt.nu/categories/docu', '0', ''])
self.assertEqual(plugin.url_for(addon.categories, category='docu'), 'plugin://plugin.video.vrt.nu/categories/docu')

# Favorites menu: '/favorites'
def test_favorites(self):
plugin.run(['plugin://plugin.video.vrt.nu/favorites/programs', '0', ''])
self.assertEqual(plugin.url_for(addon.favorites_programs), 'plugin://plugin.video.vrt.nu/favorites/programs')
2 changes: 1 addition & 1 deletion test/userdata/search_history.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
["winter", "dag", "de", "foobar"]
["winter", "dag", "test", "foobar"]