Closed eboileau closed 1 year ago
For testing, we have to deal with (not always very clearly defined) differences between in-memory sqlite and mysql. Closing this, but somehow we need to keep this in mind for writing tests. We can always revisit/refine existing tests to improve, TDD is an iterative process, no?
As for the API, the is yet to be set-up, formally speaking, but we have some template structure. I've done a quick prototyping for a typical search query, but until we go back to the Search View and FE-BE communication, it's not worth refining.
Aims/objectives.
Finalise DB setup first phase, and merge back to dev.
A clear and concise description of todo items.
Address these issues before
flask run
must be run there, and e.g.flask --app scimodom run
will not work ->Error: Could not import 'scimodom.scimodom'
. If runnignflask --app scimodom run
from /scimodom/server, the env variables are not read ->sqlalchemy.exc.ArgumentError: Expected string or URL object, got None
. For local vs. dev (and eventually e.g. production), we now rely onLOCAL_APP
to be set/unset before calling the application. We could also do something likecreate_app(os.getenv('BOILERPLATE_ENV') or 'dev')
see e.g. https://github.com/miguelgrinberg/flasky/blob/master/app/__init__.py#L20. In general, we need to cleanly sort how to handle this, and how to handle relative paths (location of .env files, and how to run the app w/ options). See also https://flask.palletsprojects.com/en/2.3.x/config/ and https://flask.palletsprojects.com/en/2.3.x/cli/test_project_validate_existing_entry
is not consistent. Where this stems from? Is this some test side-effect?test_project_add_selection
(ProjectService(Session(), project)._add_selection()
) andtest_project_create_project
(ProjectService(Session(), project).create_project()
) passed when adding aDetectionTechnology
(w/ foreign key method.id), even without defining aDetectionMethod
. With an in-memory sqlite, there is no error, but this doesn't work with mysql... why?test_dataset_create_eufid
, defineproject = _get_project(project_template, case="two")
, but useproject_template
in the function, it still picks the rightproject
?? In general, we should simplify the parametrization/conditionals to make tests simpler, and also more isolated, where possible.curl
base tables (modification, taxonomy, etc.), project, and dataset. This could be used to test, and also as a basis for the actual FE-API communication (and maintenance via API?).