Added tests for sqlalchemy models

Check the schema is created properly and the references work.