mirror of
https://0xacab.org/jvoisin/mat2-web.git
synced 2025-02-23 16:49:59 -05:00
Resolve "Delete Files After Adding To Zip"
This commit is contained in:
parent
5570b38f6c
commit
d9d4ebf3a2
@ -1,9 +1,9 @@
|
||||
image: debian:testing
|
||||
|
||||
stages:
|
||||
- build
|
||||
- linting
|
||||
- test
|
||||
- build_container
|
||||
|
||||
variables:
|
||||
CONTAINER_TEST_IMAGE: registry.0xacab.org/jvoisin/mat2-web:$CI_BUILD_REF_NAME
|
||||
@ -35,7 +35,7 @@ tests:debian:
|
||||
- python3-coverage report -m
|
||||
|
||||
build-docker:
|
||||
stage: build
|
||||
stage: build_container
|
||||
image:
|
||||
name: gcr.io/kaniko-project/executor:debug
|
||||
entrypoint: [""]
|
||||
|
1
main.py
1
main.py
@ -215,6 +215,7 @@ def create_app(test_config=None):
|
||||
)
|
||||
try:
|
||||
cleaned_files_zip.write(complete_path)
|
||||
os.remove(complete_path)
|
||||
except ValueError:
|
||||
abort(400, message='Creating the archive failed')
|
||||
|
||||
|
@ -3,6 +3,9 @@ import tempfile
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import zipfile
|
||||
|
||||
from six import BytesIO
|
||||
|
||||
import main
|
||||
|
||||
@ -208,11 +211,21 @@ class Mat2APITestCase(unittest.TestCase):
|
||||
self.assertEqual(response['meta_after'], {})
|
||||
|
||||
request = self.app.get(response['download_link'])
|
||||
zip_response = zipfile.ZipFile(BytesIO(request.data))
|
||||
self.assertEquals(2, len(zip_response.namelist()))
|
||||
for name in zip_response.namelist():
|
||||
self.assertIn('.cleaned.jpg', name)
|
||||
self.assertEqual(request.status_code, 200)
|
||||
|
||||
request = self.app.get(response['download_link'])
|
||||
self.assertEqual(request.status_code, 404)
|
||||
|
||||
request = self.app.get(upload_one['download_link'])
|
||||
self.assertEqual(request.status_code, 404)
|
||||
|
||||
request = self.app.get(upload_two['download_link'])
|
||||
self.assertEqual(request.status_code, 404)
|
||||
|
||||
def test_api_bulk_download_validation(self):
|
||||
post_body = {
|
||||
u'download_list': [
|
||||
|
Loading…
x
Reference in New Issue
Block a user