Skip to content

Commit

Permalink
ulwgl_test: add test for cache when offline
Browse files Browse the repository at this point in the history
  • Loading branch information
R1kaB3rN committed Mar 11, 2024
1 parent cf77c85 commit d9d83d1
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ULWGL/ulwgl_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,30 @@ def test_cache_interrupt(self):
"Expected Proton dir in compat to be cleaned",
)

def test_cache_offline(self):
"""Test _get_from_cache when the user is offline.
In this case, we just get the first Proton that appears since we cannot determine the latest
"""
result = None
# When user is offline, there are no files
files = []

result = ulwgl_dl_util._get_from_cache(
self.env, self.test_compat, self.test_cache, files, False
)

# Verify that the old Proton was assigned
# The test file should be there
self.assertTrue(result is self.env, "Expected the same reference")
self.assertTrue(
os.environ["PROTONPATH"], "Expected PROTONPATH env var to be set"
)
self.assertTrue(
self.env["PROTONPATH"],
"Expected PROTONPATH to be updated in dict",
)

def test_cache_old(self):
"""Test _get_from_cache when the cache is empty.
Expand Down

0 comments on commit d9d83d1

Please sign in to comment.