* add /api endpoint
* pass password in request body when using API
* flake8 fixed; tests added
* flake8 fixed test.py
---------
Co-authored-by: Reinoud van Leeuwen <reinoud.van.leeuwen@itcreation.nl>
* adding json-template for api-like functionality
* removing content-block
* adding test
* changing to flask.jsonify
* deleting template
* change from POST-param to Accept-Header
Also includes:
- Updated the versions in the requirements, as MarkupSafe did not install cleanly.
- Integration test that sets a password via the website, and then
verifies the timeout on the backend.
- Basic Makefile, updates to the docs to use the Makefile.
The requirements file was updated using pip freeze after I had updated the version of MarkupSafe. I don't know what the usual process is for this repo, so please let me know if I should use a different process there (that is why there are a few additions).
Check that:
- Password is not stored in plain text in Redis;
- The token returned has the expected format;
- The key returned is indeed the decryption key;
- API backwards compatibility is maintained: passwords stored in plain text
can be retrieved via the original URL token.
`test_returned_token_format` superseeds `test_set_password`, which
was only validating the key length.
f
- "{}".format('foo') does not work on python2.6, as the index needs to be explicitly specified.
- assertIn(x, y) was only introduced in 2.7, reverting to assertTrue(x in y)
Updated test environments definitions and docs accordingly.
- Prevent the password from displaying as b'...' in the app;
- Use Flask's `get_data(as_test=True)` to read the data, in the tests;
- Add test to ensure `get_password` is not returning bytes.