-
Notifications
You must be signed in to change notification settings - Fork 17
Feature/add rendering image attachments from trello cards #20
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
Open
Tomasz-Kluczkowski
wants to merge
24
commits into
yunojuno:master
Choose a base branch
from
Tomasz-Kluczkowski:feature/add_rendering_image_attachments_from_trello_cards
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feature/add rendering image attachments from trello cards #20
Tomasz-Kluczkowski
wants to merge
24
commits into
yunojuno:master
from
Tomasz-Kluczkowski:feature/add_rendering_image_attachments_from_trello_cards
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Added .idea/ to .gitignore.
Added requirements_dev.txt with initial requirements. Had to change psycopg2 version to 2.7.4 as it was not compatible with postgres version.
Changed deps / requirements.txt to requirements_dev.txt and run tox. Added coverage_reports folder produced by tox to .gitignore.
Added get_attachment_type method to Callbackevent. We are using requests to obtain the initial chunk of the file (preventing downloading the entire attachment). New dependencies were added - requests and python-magic which helps to get the mime type. My assumption is that the attachment's mime type signature is within the first 1024 bytes fo the file (seems to be the case for almost all files but .iso).
Added python-magic and requests to requirements_dev.txt.
Added python-magic==0.4.15 to tox.ini and ran basic tests to confirm base code works after adding get_attachment_type method to CallbackEvent.
Added addAttachmentToCard.json - json file produced by Trello with txt attachment. Added addAttachmentToCardImageType.json - json file produced by Trello with image attachment.
Added tests for get_attachment_type method in test_models.py. Had to mock out response object and file object to avoid relying on the internet connection. This obviously means that the attachment types are fed manually through use of mocks and we only test the logic of the get_attachment_type method not the actual working of the get / from_buffer.
Added logic confirming if event's payload data contains an attachment key. If so the attachment type is added to payload using CallbackEvent's get_attachment_type method and then event object is saved to the database.
…saved. Added test confirming that for events with attachment present the attachment type is properly saved in the event's payload data. To avoid connecting to the internet get_attachment_type is mocked out.
Added templatetags folder to test_app with: __init_.py - standard for packages test_app_tags.py - file containing new filter. Added is_image filter which takes value passed from the template and returns a bool (True for image attachments, false otherwise.)
Created tests folder in test_app with: __init__.py - standard for packages test_templatetags.py - file to put in template tags' tests for test_app.
Created tests folder in test_app with: __init__.py - standard for packages test_templatetags.py - file to put in template tags' tests for test_app.
Created addAttachmentToCard.html in test_app/templates/trello_webhooks which will override the default one in trello_webhooks app. Added conditional displaying of attached image if is_image template filter returns True.
Added tests of CallbackEvent render method for modified addAttachmentToCard.html template with image attachment and text attachment.
To override template also during the test test_app must be above trello_webhooks in the list of installed apps.
…Events. Introduced add_attachment_type admin method for CallbackEvents allowing easily add missing attachment types for events generated in the past. Currently the method assumes only addAttachmentToCard event types contain an attachment and hence the filtering of queryset with that parameter. This can be extended if other events also contain attachments.
Added test for add_attachment admin method in test_admin.py.
Added test of human readable representations of CallbackEvent model. Tested: __unicode__ (with object saved and not), __str__ and __repr__.
Added .flake8 - config file for flake8 linter. Used 100 chars maximum line setting as per YunoJuno code style guide online.
Fixed wrong indentation in send_to_hipchat method.
….py. Fixed wrong indentation in urlpatterns.
…n.py. Fixed missing 2 empty line separation.
…s/test_models.py. Removed unused trello import.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add rendering of attachments from trello cards to HipChat.