RDFLib/VocPrez

Implement an included store of vocabs for testing

Closed this issue · 3 comments

An in-memory triplestore (RDFlib Graph) of 3 or so vocabs can be mounted by a test setup function to allow for data-dependent testing

I had a go at adding a Github Action with a Fuseki triplestore running as a docker service. This branch includes a script to initialise a new in-memory dataset in Fuseki and load it with a couple of the CGI vocabularies that the tests look like they depend on. You can see how far I got here - a datastore running in CI, but difficulties in getting the VocPrez application to run in the Github runner (either in a container, or directly via Flask) so that the existing tests can run against it.

https://github.com/metazool/VocPrez/runs/865162635?check_suite_focus=true

I would definitely suggest adapting the existing tests so that instead of running against an existing instance of VocPrez they use the built-in Flask test client https://flask.palletsprojects.com/en/1.1.x/testing/

I started in on this and quickly realised the tests may be more data-dependent than i realised - and perhaps they have drifted out of sync a bit with the latest VocPrez interface? E.g. at https://github.com/RDFLib/VocPrez/blob/master/vocprez/_tests/test_endpoints.py#L40 - this currently 404s - is there an assumption that data will be there?

http://localhost:5000/vocabulary/?vocab_id=&_view=ckan&_format=application/json&uri=http://localhost:5000/vocabulary

I could keep on plugging away at rewriting the tests, but as I am new to looking at this project I wanted to get your opinion about the suggested approach first...

https://gist.github.com/metazool/6019612f04d10bdf149e80d20cffd22b - this was what the tests were looking like rewritten to use test_client ...

Have created a pull request to add tests that use a local file source and the flask test client. Haven't managed to link the PR to this issue directly. PR here #30