Conversation
Barecheck - Code coverage reportTotal: 96.39%Your code coverage diff: 0.05% ▴ |
|
For this I think we do want to do a bit of testing before merge. I would be very keen to have the microscope running on this branch, so we know things are covered. |
|
I've rebased this, which means it will test against the microscope. However, as this is a feature that's off by default, we're only tested that nothing is broken with the API prefix left empty. It would be nice to check that the OFM functions as expected with an API prefix specified. That may not affect the unit tests at all, possibly it only affects the integration and lifecycle tests that refer to the config files. I'll try to have a play - if it's as contained as I hope, that branch should not be a big pain to rebase as needed. The web app will need manual testing for now. The OFM test above will have checked that the changes to use |
It's now possible to configure an API prefix, which affects all LabThings-generated URLs. I've also switched a couple of places from passing the app around to creating an APIRouter, which feels much cleaner. So far, tests pass but I've not tried to set a prefix.
The previous commit laid the groundwork but failed to actually set the API prefix. This is now fixed. The API prefix is tested in a couple of places: validation is tested in `test_server_config_model`, and the endpoints are checked in `test_server` explicitly, and `test_thing_client` implicitly (because we use a prefix for the thing that's tested).
I'd accidentally modified these endpoints (and deleted `things`) when I changed the function that added them. I've now added tests for these endpoints, and fixed the URL generation in `things`.
This adds a configuration parameter for the API prefix. This will allow us to have things visible at, for example,
/api/v3/stage.The prefix applies to LabThings endpoints too, for example
/thing_descriptions/would become/api/v3/thing_descriptions.I've added tests for
app.routes)test_thing_client).If the config parameter is not used, nothing changes.
In doing this, I've swapped functions where I pass the
apparound for ones that useAPIRouterto pass the routes in a nicer way. I have not tackledThing.add_to_fastapibecause that will be a more involved change.I added some tests for the
/things/and/thing_descriptions/endpoints, and in so doing discovered I needed to fix/things/. I've done this by adding an endpoint name for the thing description of each thing: it's now namedthings.{name}, which means we can get its URL withurl_for. It would be nice to do this for all endpoints, but that's a job for another time.Closes #264