Fix gated repo tests (#26257)

* Fix gated repo tests

* Apply suggestions from code review
This commit is contained in:
Lucain 2023-09-19 13:25:12 +02:00 committed by GitHub
parent eb8489971a
commit 04191ea1e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -128,14 +128,14 @@ class GetFromCacheTests(unittest.TestCase):
self.assertIsNone(get_file_from_repo(tmp_dir, "b.txt"))
@unittest.skip("Test is broken, fix me Wauplain!")
def test_get_file_gated_repo(self):
"""Test download file from a gated repo fails with correct message when not authenticated."""
with self.assertRaisesRegex(EnvironmentError, "You are trying to access a gated repo."):
cached_file(GATED_REPO, README_FILE, use_auth_token=False)
# All files except README.md are protected on a gated repo.
cached_file(GATED_REPO, "gated_file.txt", use_auth_token=False)
@unittest.skip("Test is broken, fix me Wauplain!")
def test_has_file_gated_repo(self):
"""Test check file existence from a gated repo fails with correct message when not authenticated."""
with self.assertRaisesRegex(EnvironmentError, "is a gated repository"):
has_file(GATED_REPO, README_FILE, use_auth_token=False)
# All files except README.md are protected on a gated repo.
has_file(GATED_REPO, "gated_file.txt", use_auth_token=False)