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