Doveps / mono

Code for Doveps projects
http://doveps.com
MIT License
0 stars 0 forks source link

03-07-2018 Report: Issue on DB #125

Closed JosiahRegencia closed 6 years ago

JosiahRegencia commented 6 years ago

Removed API endpoint for test cases. Tried to flavor create and flavor comparison endpoints in comparison test case, result of json file still showed "no changes". With that said, I think issue #119 should be fixed before I could go to fix issue #117

So I did some reading and I'm starting to second guess about the way savant connects to DB. While Psycopg2 does the job pretty well, thus far, most of what I read seems to point out using ORM, SQLAlchemy, to connect to the database:

http://www.patricksoftwareblog.com/unit-testing-a-flask-application/

http://koo.fi/blog/2015/10/22/flask-sqlalchemy-and-postgresql-unit-testing-with-transaction-savepoints/

In addition, the current test cases don't seem to be saving data to the DB. Links above show unit tests with Flask connecting to DB using SQLAlchemy. I haven't seen any unit tests using psycopg2 yet. If that's the case, I think I may have to redo my way of connecting to the database. A change in savant/app/query.py might be necessary. And I think everything in it should be replaced. With your permission, I think I'd have to do that one first. And then fix #119 and then fix #117. Will ask about this in the meeting tomorrow.

greenmoss commented 6 years ago

Is there any way to preserve the current code, using psycopg? It's ok if it's not quite as good as SQLAlchemy, as long as it gets the job done. Right now, I prefer to focus on anything that gets us to the demo most quickly.

For #119 I have forgotten; can you update the description? That will enable me to make a better decision

Those two links are interesting reading. I'll also caution that unit testing can also cause problems on its own; check out

https://medium.com/@drozzy/why-unit-testing-sucks-eb87176f310b