2020-03-19 16:45:31 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
""" Tests """
|
|
|
|
|
2020-03-20 13:53:21 +01:00
|
|
|
from __future__ import absolute_import, division, unicode_literals
|
|
|
|
|
2020-03-19 16:45:31 +01:00
|
|
|
import logging
|
2020-07-09 10:16:45 +02:00
|
|
|
import os
|
|
|
|
import sys
|
2020-03-19 16:45:31 +01:00
|
|
|
|
2020-07-09 10:16:45 +02:00
|
|
|
import xbmcaddon
|
|
|
|
|
2020-11-04 12:48:33 +01:00
|
|
|
try: # Python 3
|
|
|
|
from http.client import HTTPConnection
|
|
|
|
except ImportError: # Python 2
|
|
|
|
from httplib import HTTPConnection
|
|
|
|
|
|
|
|
logging.basicConfig(level=logging.DEBUG)
|
|
|
|
|
|
|
|
# Add logging to urllib
|
|
|
|
HTTPConnection.debuglevel = 1
|
2020-07-09 10:16:45 +02:00
|
|
|
|
|
|
|
# Make UTF-8 the default encoding in Python 2
|
|
|
|
if sys.version_info[0] == 2:
|
2020-10-26 10:25:57 +01:00
|
|
|
reload(sys) # pylint: disable=undefined-variable # noqa: F821
|
2020-07-09 10:16:45 +02:00
|
|
|
sys.setdefaultencoding("utf-8") # pylint: disable=no-member
|
|
|
|
|
|
|
|
# Set credentials based on environment data
|
2020-11-04 12:48:33 +01:00
|
|
|
# Use the .env file with Pipenv to make this work nicely during development
|
|
|
|
ADDON = xbmcaddon.Addon()
|
|
|
|
if os.environ.get('ADDON_USERNAME'):
|
2020-07-09 10:16:45 +02:00
|
|
|
ADDON.setSetting('username', os.environ.get('ADDON_USERNAME'))
|
2020-11-04 12:48:33 +01:00
|
|
|
if os.environ.get('ADDON_PASSWORD'):
|
2020-07-09 10:16:45 +02:00
|
|
|
ADDON.setSetting('password', os.environ.get('ADDON_PASSWORD'))
|