Features
* Added 'get_courrier_type' endpoint that return a 'courrier type' for a given type_dossier
* Added url parameter 'type_dossier_detaille' to 'create_dossier' to post it in the request body
* Replaced the way 'type fichier' is defined: now looks into 'XXX_type_raw' for file 'XXX'
Fixes
* Url components are now encoded
* Pylint warnings
* Loging do not raise an error when 'files' var is empty in 'create_dossier'
Tests
* Added 2 new errors tests to 'test_create_dossier'
* Added 'test_get_courrier_type' to test endpoint 'get_courrier_type'
* Fixed pylint warnings
Features:
* A connector now can be associated with 'collectivites',
and each of them can have one 'guichet'.
A 'collectivite' have a name and an openADS technical identifier
A 'guichet' allow to define hours and days for when its 'collectivite' is "open"
* Each of those entities have a view to CRUD it
* For entity ForwardFile:
- Added association with a connector, and eventually a 'collectivite'
- Added ForwardFiles 'size' field
- Added updating fields 'content_type', 'file_hash' and 'size' on save()
- Added custom validation on save()
* For entity AtrealOpenads:
- Added permissions on each endpoint
- Added 'email' field support for each type of 'demandeur'
- 'numero_dossier' is now required in the url for some endpoints (previously was a GET param)
- Added 'upload_user_files' as an endpoint (but can still be used as a method with request=None)
- The 'upload_user_files()' method now only handle forward file that have status='pending'
Fixes:
* Added "*args" and "**kwargs" arguments to some connector endpoint methods
* Added 'verbose_name' and 'ordering' on each entity META
* Added decorator '@force_encoded_string_output' to prevent utf-8 issues with python2
* Added __repr__, __str__ and __unicode__ functions to each entities
* Added database indexes for each entity
* Commented out useless JSON schema imports
* Removed unused variable assignations
Refactoring:
* Moved utilities functions to utils.py file
* Added a BaseModel to provide some default functions for Models
* Added enum/translations of hard-coded values for ForwardFile 'upload_status' field
Tests:
* Added test for each entity
* Added tests files specific to utilities, forms and views
* Total code coverage is 99% with only 10 statement missed
Features:
* replaced the loging of json payload with the use of a DictDumper that lazy truncate strings too long
* homogenize error messages
Fixes:
* changed the signature of 'check_file_dict()' to match other functions and fix a bug
* changed the signature of 'upload2ForwardFile()' to force input for 'type_fichier' argument
Refactoring:
* removed dead code in 'upload_user_files()'
* using 'basestring' instead of testing for 'str' and 'unicode'
* renamed 'requerant' by 'demandeur'
* removed useless and maybe problematic 'join()' (forgotten from the previous commit)
* added more comments
Tests:
* 100% test coverage!
* fixed failing tests
* added tests for every function
* completed missing tests (mostly for exceptions)
* added more comments
* added the lines of missing statement in the coverage report
Feature:
* JSON Schema input validation enabled (again)
Fixes:
* utf-8 decode error fixed: added unicode to litterals
* removed useless and maybe problematic 'str()' forced casting
* remove useless and maybe problematic 'join()' on list of file ids
Refactoring:
* property 'extra_debug_enabled' removed (not used since some commits)
* in function 'normalize()' only cast to 'unicode' if value is not already 'unicode'
Features:
* class AtrealOpenads now extends HTTPResource for HTTP Basic credentials
* check_status is now also an endpoint (endpoint 'test_openads_connexion' deleted)
* added JSON schema to validate POST request input (ouput schemas are defined too but unused for now)
* added class 'LogJsonPayloadWithFileContent' to lazy log a json payload with content file filtered
* added 'attempt' field to class 'ForwardFile' that count the attempt of uploading to openADS.API
* added more controls over response data received
Refactoring:
* removed the file content in function 'get_fwd_files_status()' and added content size instead
* splitted the function 'get_fwd_files_status()' in two: one that retrieve detailed files, one only the summary
* added function 'log_json_payload()' to help to log json payloads
* added 2 functions to factorize the process of getting files from json payload
* added function 'check_file_dict()' to factorize the process of checking a file dictionary
Fixes:
* Default filename are now under 50 chars
* Make the function 'get_fwd_files_status()' consistent in its return
Tests:
* updated the test to reflect the use of HTTPResource and the split of 'get_fwd_files_status()'
More:
* Added a lot of comments
* Added endpoint anotation to validate response body, but its commented as the 'get' helper is not defined (not like the 'post' one)
Packaging:
* added author, description, classifiers, scripts and requirements in 'setup.py'
Tests:
* added support for 'tox.ini'
* moved 'tests' directory outside main python module
Fixes:
* namespace is 'atreal_openads' instead of 'passerelle.apps.atreal_openads'
* increased timeout removed from 'get' requests
* fixed timeout typo on 'self.openADS_API_timeout'
Tests:
* moved 'tests' folder inside 'atreal_openads' module
* removed useless settings.py file
* removed useless imports
* added test file 'resources'
* fixed file path (no more vagrant)
* updated the test case of 'upload2ForwardFile' to test for 'plan' type_fichier
* added HTTP Basic credentials to 'atreal_openads' fixture (removed 'token')
Fixes:
* stop guessing ForwardFile.type_fichier based on file path
Features:
* added support for a payload build from the request instead of hardcoded in
function 'create_dossier()'
* added a warning message when an APIError is raised all functions
* added the name/key of the error in the error message build from a response
* added a function 'normalize()' to normalize user's input in the payload
* changed endpoint arguments coming from request parameters instead of URI path
in functions 'create_dossier()', 'get_dossier()', 'get_courrier()' and
'get_fwd_files_status()'
* changed JSON response to use an explicit key to hold file data in function
'create_dossier()':'recepisse' and 'get_courrier()':'courrier'
* removed the useless key 'data' in all the JSON response
* removed useless case 'jsondata' in function 'afile()'
Cleaning:
* Removed useless variable 'dossier_payload'
Tests:
* added request containing the payload in the test case for 'create_dossier()'
* added the name/key of the error in the error message build from a response
* used the explicit keys 'recepisse' and 'courrier' in JSON responses
* removed the 'data' key from JSON responses
* function 'echofile()' support for posted file content, not just url
Bug fix
* corrected file content in function 'afile()'
* corrected payload assignment in function 'get_fwd_files_status()'
* added 'type_dossier' to job creation in function 'create_dossier()'
Coding style: better indentation
Logging : 'debug' instead of 'info'
Locale : identifier in english instead of french