Commit Graph

12 Commits

Author SHA1 Message Date
Sergi Delgado Segura
88c19d5a0d teos - moves errors to common so it can be used by clients 2020-04-29 13:03:39 +02:00
Sergi Delgado Segura
2e6095971d Improves docstrings 2020-04-20 17:58:41 +02:00
Sergi Delgado Segura
3f15459f2c Creates ExtendedAppointment as an appointment with user information 2020-04-20 17:58:16 +02:00
Sergi Delgado Segura
86e97e37bf Removes start/end time from appointment 2020-04-20 17:56:58 +02:00
Sergi Delgado Segura
08701f0fee Refactors Cryptographer to remove logs and avoid multi return types
Cryptographer now uses exceptions to report errors and does not use the log anymore
2020-04-20 17:30:16 +02:00
Sergi Delgado Segura
fe73ee7298 Fixes comments, docstrings and some renamings 2020-04-02 15:20:09 +02:00
Sergi Delgado Segura
b3d67b4ce3 Refactors Inspector so it returns exceptions for invalid data instead of error codes
Defines InspectionFailed, and exception that it's raised for invalid parameters. The design looks much cleaner now.
2020-03-26 17:10:16 +01:00
Sergi Delgado Segura
83b3913cb5 Adds basic authentication logic.
+ Users need to be registered in order to send appointments (free registration for now)
+ The tower gives them a number of appointments to work with
+ Non-registered users and users with no enough appoitnemnts slots return the same error (to avoid proving)

- Authentication does not cover get_* requests yet
- No tests
- No docs
2020-03-25 17:13:35 +01:00
Sergi Delgado Segura
dd53ad68fb Fixes bug when dealing with empty JSON requests or empty appointment field
When posting a request via requests.post the json field was dumped to json, but it shouldn't have been since requests deals with this internally. That meant that the requests made by the code didn't match proper JSON.
In line with this, the API was only parsing this type POST requests correctly, making add_appointment to fail if a proper formatted JSON was passed.

On top of that, empty appointments were not checked in the Inspector before trying to get data from them, making it crash if a JSON was posted to add_appointment not containing the `appointment` field. Unit tests for this should be added.
2020-03-24 20:17:03 +01:00
Sergi Delgado Segura
b43731397c Updates teos to work with the new conf file format and redefines how objects are built
Configuration parameters are now load from a .conf file (see template.conf as an example).

The code has 3 config levels: default (teos/__init__.py), config file (<data_dir>/teos.conf) and command line.
Most of the config parameters are only modificable trough the config file for now.
The priority order is: command line, config file, default.

Objects that need config parameters are now built in teosd instead of inside other classes. Therefore teosd acts like a factory and config parameters don't have to be passed around between objects. This also implies that a lot of the object creation logic has been changed.

This should simplify unit testing.
2020-03-20 21:38:28 +01:00
Sergi Delgado Segura
045417aefc Adds missing inspector sig check from #103 2020-03-19 22:31:00 +01:00
Sergi Delgado Segura
7c7ff909d7 pisa -> teos 2020-03-17 15:47:38 +01:00