Skip to content

Commit

Permalink
test: check the disk status is returning the correct info
Browse files Browse the repository at this point in the history
  • Loading branch information
alycejenni committed Dec 1, 2023
1 parent 14b8ad5 commit 2611e19
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/profiles/test_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ async def test_use_source_converts_non_jpeg_file(self, config,
img_name = f'image_{img_mode}.{img_format}'
info = ImageInfo('test', img_name, 100, 100)
create_image(config, 100, 100, 'test', img_name, img_format, img_mode)
async with disk_profile_with_pool.use_source(info) as source_path:
assert source_path == disk_profile_with_pool.cache_path / 'jpeg' / (
async with disk_profile_with_pool.use_source(info) as converted_path:
assert converted_path == disk_profile_with_pool.cache_path / 'jpeg' / (
img_name + '.jpg')

async def test_resolve_filename_no_file(self, config, disk_profile):
Expand Down Expand Up @@ -96,3 +96,13 @@ async def test_get_original_size(self, config, disk_profile):
size = path.stat().st_size
profile_size = await disk_profile.resolve_original_size('image')
assert size == profile_size

async def test_get_status(self, config, disk_profile_with_pool):
img_name = 'image.tiff'
info = ImageInfo('test', img_name, 100, 100)
create_image(config, 100, 100, 'test', img_name, 'tiff')
async with disk_profile_with_pool.use_source(info) as converted_path:
size = converted_path.stat().st_size
status = await disk_profile_with_pool.get_status()
assert 'converted_cache' in status
assert status['converted_cache']['cache_size'] == f'{size} Bytes'

0 comments on commit 2611e19

Please sign in to comment.