modules.random_org unit tests: skip if random.org down

This commit is contained in:
Justin Findlay 2016-06-07 12:20:14 -06:00
parent 1f9422e0cd
commit 82f95429db

View file

@ -18,11 +18,21 @@ from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import Salt Libs
import salt.utils.http
from salt.modules import random_org
random_org.__opts__ = {}
def check_status():
'''
Check the status of random.org
'''
ret = salt.utils.http.query('https://api.random.org/', status=True)
return ret['status'] == 200
@skipIf(not check_status(), 'random.org is not available')
@skipIf(NO_MOCK, NO_MOCK_REASON)
class RandomOrgTestCase(TestCase):
'''