diff --git a/tests/test_ubicast_packages_access.py b/tests/test_ubicast_packages_access.py index f547e3fcd0bd4b7854f85422ec71ac0af61abcaf..08b71e18639ec6358fc4087ff96fa14b3b7f504d 100755 --- a/tests/test_ubicast_packages_access.py +++ b/tests/test_ubicast_packages_access.py @@ -7,14 +7,28 @@ Check that the updates server is reachable and that the system is still under su import os import re import requests +import subprocess import sys +try: + from requests.packages.urllib3.exceptions import InsecureRequestWarning + requests.packages.urllib3.disable_warnings(InsecureRequestWarning) +except ImportError: + requests.packages.urllib3.disable_warnings() + # SkyReach APT file test apt_source = '/etc/apt/sources.list.d/skyreach.list' if not os.path.exists(apt_source): print('The file "%s" does not exists.' % apt_source) - sys.exit(1) + # Check if the test should return an error (if a UbiCast service is installed) + for package in ('python3-mediaserver', 'python3-mediaserver-monitor', 'campus-manager', 'skyreach', 'celerity-workers'): + p = subprocess.run(['dpkg', '-s', package], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + if p.returncode == 0: + sys.exit(1) + # No service installed, return non testable status + print('No UbiCast service is installed, ignoring test result.') + sys.exit(2) with open(apt_source, 'r') as fo: content = fo.read()