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