Adds unit tests for db_task_history, bug fixes

Uses sqlite3 in memory mode for db.
If sqlalchemy can't be imported, skips the test rather than failing.
Merge pull request #151 from JoeEnnever/db_fix

Adds unit tests for db_task_history, bug fixes