Changeset f0e64eb in OpenWorkouts-current for ow/tests/views/test_user.py
- Timestamp:
- Feb 15, 2019, 11:00:35 AM (5 years ago)
- Branches:
- current, feature/docs, master
- Children:
- 0fa21cd
- Parents:
- eb20dc8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ow/tests/views/test_user.py
reb20dc8 rf0e64eb 5 5 from shutil import copyfileobj 6 6 from unittest.mock import Mock, patch 7 from io import BytesIO 7 8 8 9 import pytest … … 15 16 16 17 from webob.multidict import MultiDict 18 19 from PIL import Image 17 20 18 21 from ow.models.root import OpenWorkouts … … 417 420 assert response.status_int == 200 418 421 assert response.content_type == 'image' 422 # as we did not pass a specific size as a get parameter, the size is 423 # the same as the original image 424 original_image = Image.open(image_path) 425 returned_image = Image.open(BytesIO(response.body)) 426 assert original_image.size == returned_image.size 427 428 # now, ask for a smaller image 429 request.GET['size'] = original_image.size[0] - 20 430 response = user_views.profile_picture(user, request) 431 assert isinstance(response, Response) 432 assert response.status_int == 200 433 assert response.content_type == 'image' 434 # now the size of the original image is bigger 435 returned_image = Image.open(BytesIO(response.body)) 436 assert original_image.size > returned_image.size 437 438 # now, ask for a size that is bigger than the original image, 439 # image will be the same size, as we do not "grow" its size 440 request.GET['size'] = original_image.size[0] + 1000 441 response = user_views.profile_picture(user, request) 442 assert isinstance(response, Response) 443 assert response.status_int == 200 444 assert response.content_type == 'image' 445 # now the size of the original image is bigger 446 returned_image = Image.open(BytesIO(response.body)) 447 assert original_image.size == returned_image.size 448 419 449 420 450 def test_edit_profile_get(self, dummy_request, john):
Note: See TracChangeset
for help on using the changeset viewer.