Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CC-2137 NZSL: move signbank to Poetry - round 3 #173

Closed
wants to merge 15 commits into from
13 changes: 6 additions & 7 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ django-tagging = "*"
boto3 = "*"
certifi = "*"
dj-database-url = "*"
gunicorn = "*"
# gunicorn 22.* has Worker (no URI read) issue
# https://github.com/benoitc/gunicorn/issues/3207
gunicorn = "~21.2.0"
psycopg2 = "*"
sentry-sdk = "*"
whitenoise = "*"
Expand Down
13 changes: 6 additions & 7 deletions signbank/dictionary/tests/tests_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from __future__ import unicode_literals

import random
import tempfile
from unittest import mock

from django.conf import settings
Expand Down Expand Up @@ -35,24 +36,22 @@ def setUp(self):

@override_settings(MEDIA_ROOT="")
def test_retrieve_videos_for_glosses(self):

video_details = [
{
"url": "/kiwifruit_1.mp4",
"file_name": (
f"{settings.MEDIA_ROOT}/glossvideo/"
f"{self.gloss.pk}-{self.gloss.idgloss}_finalexample_1.png"
),
"file_name": f"{self.gloss.pk}-{self.gloss.idgloss}_finalexample_1.png",
"gloss_pk": self.gloss.pk,
"video_type": "finalexample1",
"version": 0
}
]
dummy_file = SimpleUploadedFile(
video_details[0]["file_name"], b'data \x00\x01', content_type="video/mp4")
dummy_file = tempfile.NamedTemporaryFile()
dummy_file.write(b'data \x00\x01')

with mock.patch("signbank.dictionary.tasks.urlretrieve") as mock_retrieve:
with mock.patch("signbank.dictionary.tasks.connection.close") as mock_close_connection:
mock_retrieve.return_value = (dummy_file, None)
mock_retrieve.return_value = (dummy_file.name, None)
mock_close_connection.return_value = None
retrieve_videos_for_glosses(video_details)
mock_retrieve.assert_called_once()
Expand Down
1 change: 1 addition & 0 deletions signbank/video/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def url(self, name):


class GlossVideoDynamicStorage(import_string(settings.GLOSS_VIDEO_FILE_STORAGE)):

def public_url(self, name):
""" Return the public URL to the object in S3 or local storage.
This is NOT a presigned URL, use #url for that.
Expand Down
Loading