| @@ 51-64 (lines=14) @@ | ||
| 48 | call_command( |
|
| 49 | 'rendervariations', |
|
| 50 | 'tests.ThumbnailModel.image' |
|
| 51 | ) |
|
| 52 | assert any([os.path.exists(f) for f in file_names]) |
|
| 53 | ||
| 54 | def test_no_replace(self, image_upload_file): |
|
| 55 | obj = ThumbnailModel.objects.create(image=image_upload_file) |
|
| 56 | file_path = obj.image.thumbnail.path |
|
| 57 | assert os.path.exists(file_path) |
|
| 58 | before = os.path.getmtime(file_path) |
|
| 59 | time.sleep(1) |
|
| 60 | call_command( |
|
| 61 | 'rendervariations', |
|
| 62 | 'tests.ThumbnailModel.image', |
|
| 63 | ) |
|
| 64 | assert os.path.exists(file_path) |
|
| 65 | after = os.path.getmtime(file_path) |
|
| 66 | assert before == after |
|
| 67 | ||
| @@ 37-49 (lines=13) @@ | ||
| 34 | def test_multiprocessing(self, image_upload_file): |
|
| 35 | objs = [ |
|
| 36 | ThumbnailModel.objects.create( |
|
| 37 | image=image_upload_file |
|
| 38 | ) |
|
| 39 | for _ in range(100) |
|
| 40 | ] |
|
| 41 | file_names = [ |
|
| 42 | obj.image.thumbnail.path |
|
| 43 | for obj in objs |
|
| 44 | ] |
|
| 45 | for obj in objs: |
|
| 46 | obj.image.delete_variations() |
|
| 47 | assert not any([os.path.exists(f) for f in file_names]) |
|
| 48 | call_command( |
|
| 49 | 'rendervariations', |
|
| 50 | 'tests.ThumbnailModel.image' |
|
| 51 | ) |
|
| 52 | assert any([os.path.exists(f) for f in file_names]) |
|