Skip to content

Commit

Permalink
Add mimetype sniffer and update test dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
anishTP committed Nov 10, 2023
1 parent 64d3918 commit f98aa1b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 28 deletions.
43 changes: 20 additions & 23 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ alembic==1.12.1
aniso8601==9.0.1
# via coaster
anyio==4.0.0
# via httpcore
# via httpx
argon2-cffi==23.1.0
# via -r requirements/base.in
argon2-cffi-bindings==21.2.0
Expand All @@ -55,15 +55,15 @@ bleach==6.1.0
# via
# baseframe
# coaster
blinker==1.6.3
blinker==1.7.0
# via
# -r requirements/base.in
# baseframe
# coaster
# flask
boto3==1.28.72
boto3==1.28.83
# via -r requirements/base.in
botocore==1.31.72
botocore==1.31.83
# via
# boto3
# s3transfer
Expand All @@ -83,7 +83,7 @@ cffi==1.16.0
# via
# argon2-cffi-bindings
# cryptography
charset-normalizer==3.3.1
charset-normalizer==3.3.2
# via
# aiohttp
# requests
Expand Down Expand Up @@ -114,7 +114,7 @@ dnspython==2.4.2
# pyisemail
emoji==2.8.0
# via baseframe
filelock==3.12.4
filelock==3.13.1
# via tldextract
flask==3.0.0
# via
Expand Down Expand Up @@ -146,9 +146,9 @@ flask-caching==2.1.0
# via baseframe
flask-executor==1.0.0
# via -r requirements/base.in
flask-flatpages==0.8.1
flask-flatpages==0.8.2
# via -r requirements/base.in
flask-mailman==0.3.0
flask-mailman==1.0.0
# via -r requirements/base.in
flask-migrate==4.0.5
# via
Expand Down Expand Up @@ -202,19 +202,19 @@ html5lib==1.1
# via
# baseframe
# coaster
httpcore==0.18.0
httpcore==1.0.1
# via httpx
httplib2==0.22.0
# via
# oauth2
# oauth2client
httpx[http2]==0.25.0
httpx[http2]==0.25.1
# via
# -r requirements/base.in
# python-telegram-bot
hyperframe==6.0.1
# via h2
icalendar==5.0.10
icalendar==5.0.11
# via -r requirements/base.in
idna==3.4
# via
Expand Down Expand Up @@ -248,9 +248,9 @@ linkify-it-py==2.0.2
# via -r requirements/base.in
lxml==4.9.3
# via premailer
mako==1.2.4
mako==1.3.0
# via alembic
markdown==3.5
markdown==3.5.1
# via
# coaster
# flask-flatpages
Expand All @@ -270,14 +270,12 @@ markupsafe==2.1.3
# wtforms
marshmallow==3.20.1
# via dataclasses-json
maxminddb==2.4.0
maxminddb==2.5.1
# via geoip2
mdit-py-plugins==0.4.0
# via -r requirements/base.in
mdurl==0.1.2
# via markdown-it-py
mkdocs-material-extensions==1.3
# via flask-mailman
multidict==6.0.4
# via
# aiohttp
Expand All @@ -304,7 +302,7 @@ packaging==23.2
# marshmallow
passlib==1.7.4
# via -r requirements/base.in
phonenumbers==8.13.23
phonenumbers==8.13.24
# via -r requirements/base.in
premailer==3.10.0
# via -r requirements/base.in
Expand Down Expand Up @@ -425,7 +423,7 @@ semantic-version==2.10.0
# via
# baseframe
# coaster
sentry-sdk==1.32.0
sentry-sdk==1.34.0
# via baseframe
six==1.16.0
# via
Expand All @@ -442,9 +440,8 @@ six==1.16.0
sniffio==1.3.0
# via
# anyio
# httpcore
# httpx
sqlalchemy==2.0.22
sqlalchemy==2.0.23
# via
# -r requirements/base.in
# alembic
Expand All @@ -463,7 +460,7 @@ statsd==4.0.1
# via baseframe
tinydb==4.8.0
# via tuspy
tldextract==5.0.1
tldextract==5.1.0
# via
# coaster
# mxsniff
Expand All @@ -475,7 +472,7 @@ tuspy==1.0.1
# via pyvimeo
tweepy==4.14.0
# via -r requirements/base.in
twilio==8.10.0
twilio==8.10.1
# via -r requirements/base.in
types-python-dateutil==2.8.19.14
# via arrow
Expand Down Expand Up @@ -524,7 +521,7 @@ werkzeug==3.0.1
# flask
whitenoise==6.6.0
# via -r requirements/base.in
wtforms==3.1.0
wtforms==3.1.1
# via
# baseframe
# flask-wtf
Expand Down
8 changes: 4 additions & 4 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ pytest-cov==4.1.0
# via -r requirements/test.in
pytest-dotenv==0.5.2
# via -r requirements/test.in
pytest-env==1.1.0
pytest-env==1.1.1
# via -r requirements/test.in
pytest-html==4.0.2
pytest-html==4.1.1
# via pytest-selenium
pytest-metadata==3.0.0
# via pytest-html
Expand Down Expand Up @@ -94,9 +94,9 @@ sttable==0.0.1
# via -r requirements/test.in
tenacity==8.2.3
# via pytest-selenium
tomlkit==0.12.1
tomlkit==0.12.2
# via -r requirements/test.in
trio==0.22.2
trio==0.23.1
# via
# selenium
# trio-websocket
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/views/preview_image_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
import io
from magic import from_buffer
from PIL import Image

from funnel.views.thumbnails import render_project_preview_image
Expand All @@ -14,5 +15,6 @@ def test_preview_image_jobs(project_expo2011) -> None:
def test_preview_image_size(project_expo2011) -> None:
render_project_preview_image(project_id=project_expo2011.id)
preview_image = Image.open(io.BytesIO(project_expo2011.preview_image))
result = from_buffer(io.BytesIO(project_expo2011.preview_image).read(2048), mime=True)
assert preview_image.size == (1280, 720)
assert preview_image.format is 'PNG'
assert result == 'image/png'

0 comments on commit f98aa1b

Please sign in to comment.