Added unit-tests for authentication.

There were previously no unit-tests for the apiHandler which provides authentication for most service endpoints. These tests were previously implicit in the full-stack integration tests which were usually performed.