piccole migliorie test

This commit is contained in:
mac12m99
2021-03-23 22:38:37 +01:00
parent 9881e04427
commit 6a9d1e9bea
2 changed files with 11 additions and 13 deletions

View File

@@ -3,9 +3,9 @@ rm tests/home/userdata/addon_data/plugin.video.kod/settings_servers/*.json
rm tests/home/userdata/addon_data/plugin.video.kod/cookies.dat
rm tests/home/userdata/addon_data/plugin.video.kod/kod_db.sqlite
python3 -m pip install --upgrade pip
pip install sakee
pip install html-testRunner
pip install parameterized
pip install -U sakee
pip install -U html-testRunner
pip install -U parameterized
export PYTHONPATH=$PWD
export KODI_INTERACTIVE=0
export KODI_HOME=$PWD/tests/home

View File

@@ -315,6 +315,7 @@ class GenericServerTest(unittest.TestCase):
def test_get_video_url(self):
module = __import__('servers.%s' % self.name, fromlist=["servers.%s" % self.name])
page_url = self.server.url
httptools.default_headers['Referer'] = self.server.referer
print('testing ' + page_url)
print('Found on ' + self.server.foundOn)
print()
@@ -342,10 +343,10 @@ class GenericServerTest(unittest.TestCase):
print(headers)
if 'magnet:?' in directUrl: # check of magnet links not supported
continue
if directUrl.split('.')[-1] == 'm3u8': # m3u8 is a text file and HEAD may be forbidden
page = downloadpage(directUrl, headers=headers, use_requests=True, verify=False)
else:
page = downloadpage(directUrl, headers=headers, only_headers=True, use_requests=True, verify=False)
if not page.success and directUrl.split('.')[-1] == 'm3u8': # m3u8 is a text file and HEAD may be forbidden
page = downloadpage(directUrl, headers=headers, use_requests=True, verify=False)
self.assertTrue(page.success, self.name + ' scraper returned an invalid link')
self.assertLess(page.code, 400, self.name + ' scraper returned a ' + str(page.code) + ' link')
contentType = page.headers['Content-Type']
@@ -356,10 +357,7 @@ class GenericServerTest(unittest.TestCase):
if __name__ == '__main__':
if 'KOD_TST_CH' not in os.environ:
unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(report_name='report', add_timestamp=False, combine_reports=True,
report_title='KoD Test Suite', template=os.path.join(config.get_runtime_path(), 'tests', 'template.html')), exit=False)
import webbrowser
webbrowser.open(os.path.join(outDir, 'report.html'))
else:
unittest.main()