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
|
image: debian:testing
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- build
|
|
||||||
- linting
|
- linting
|
||||||
- test
|
- test
|
||||||
|
- build_container
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
CONTAINER_TEST_IMAGE: registry.0xacab.org/jvoisin/mat2-web:$CI_BUILD_REF_NAME
|
CONTAINER_TEST_IMAGE: registry.0xacab.org/jvoisin/mat2-web:$CI_BUILD_REF_NAME
|
||||||
@ -35,7 +35,7 @@ tests:debian:
|
|||||||
- python3-coverage report -m
|
- python3-coverage report -m
|
||||||
|
|
||||||
build-docker:
|
build-docker:
|
||||||
stage: build
|
stage: build_container
|
||||||
image:
|
image:
|
||||||
name: gcr.io/kaniko-project/executor:debug
|
name: gcr.io/kaniko-project/executor:debug
|
||||||
entrypoint: [""]
|
entrypoint: [""]
|
||||||
|
1
main.py
1
main.py
@ -215,6 +215,7 @@ def create_app(test_config=None):
|
|||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
cleaned_files_zip.write(complete_path)
|
cleaned_files_zip.write(complete_path)
|
||||||
|
os.remove(complete_path)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
abort(400, message='Creating the archive failed')
|
abort(400, message='Creating the archive failed')
|
||||||
|
|
||||||
|
@ -3,6 +3,9 @@ import tempfile
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import zipfile
|
||||||
|
|
||||||
|
from six import BytesIO
|
||||||
|
|
||||||
import main
|
import main
|
||||||
|
|
||||||
@ -208,11 +211,21 @@ class Mat2APITestCase(unittest.TestCase):
|
|||||||
self.assertEqual(response['meta_after'], {})
|
self.assertEqual(response['meta_after'], {})
|
||||||
|
|
||||||
request = self.app.get(response['download_link'])
|
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)
|
self.assertEqual(request.status_code, 200)
|
||||||
|
|
||||||
request = self.app.get(response['download_link'])
|
request = self.app.get(response['download_link'])
|
||||||
self.assertEqual(request.status_code, 404)
|
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):
|
def test_api_bulk_download_validation(self):
|
||||||
post_body = {
|
post_body = {
|
||||||
u'download_list': [
|
u'download_list': [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user