Sanitized testing code a bit
Better database setup/teardown in tests
Added API key authentication

Also, basic authorization checks.