HTTP-APIs / hydrus

REST server - Flask Hydra-powered for Semantic Web
https://pypi.org/project/hydrus/
MIT License
195 stars 130 forks source link

Tests for column datatypes in DB Models #596

Open chrizandr opened 3 years ago

chrizandr commented 3 years ago

I'm submitting a

Current Behaviour:

Tests need to be added for the database built by the DB Model and check if the column types match based on the API Documentation. We should note here that we only match xsd:integer/float, all others should be varchar.

Expected Behaviour:

Steps to reproduce:

Snapshot:

Environment:

* python version * pip version * OS details ### Do you want to work on this issue?
farazkhanfk7 commented 3 years ago

@chrizandr The docs that we're currently using for tests don't have any supported property with range xsd:integer or float . But still to test the behaviour I've made changes in gen_dummy_object function in conftest.py ( commit dc5f7c2a ) to make sure that a random integer/float is returned if Column type in database is integer/float. This behavior is being tested throughout test cases as we're using it in test_app.py and test_crud.py in hydrus.

Couldn't find any other way to test column types. What else should we add here ?

chrizandr commented 3 years ago

Ideally it should be a test to see if xsd:float is given in the documentation, then is the column for that property created with the correct datatype or not.

I noticed that we don't have any properties in the current API documentation, let's leave this for now till we have a better API doc to test