move commits into helper functions

clean up postgres setup in test_views, add an api test for the api key generating endpoint