diff --git a/tests/helper.py b/tests/helper.py index 23afdb6b4..9fb66589b 100644 --- a/tests/helper.py +++ b/tests/helper.py @@ -24,6 +24,15 @@ async def __call__(self, *args, **kwargs): """ +ERROR_403 = b""" + +403 Forbidden + +

Forbidden

+

You don't have permission to access this resource.

+ +""" + SIMPLE_WORDS = """house 34444 0.3232 0.123213 1.231231 dog 14444 0.76762 0.76767 1.45454""" @@ -45,7 +54,7 @@ def generate_simple_vocab(): class VocabDownloader: - url = 'https://medcat.rosalind.kcl.ac.uk/media/vocab.dat' + url = 'https://cogstack-medcat-example-models.s3.eu-west-2.amazonaws.com/medcat-example-models/vocab.dat' vocab_path = "./tmp_vocab.dat" _has_simple = False @@ -54,6 +63,8 @@ def is_valid(self): content = f.read() if content == ERROR_503: return False + if content == ERROR_403: + return False v = Vocab.load(self.vocab_path) if len(v.vocab) == 2: # simple one self._has_simple = True @@ -64,7 +75,7 @@ def check_or_download(self): if os.path.exists(self.vocab_path) and self.is_valid(): return tmp = requests.get(self.url) - if tmp.content == ERROR_503: + if tmp.content == ERROR_503 or tmp.content == ERROR_403: print('Rosalind server unavailable') if self._has_simple: print('Local simple vocab already present')