Adds unittests for loginHandle in api

* Adds helpers.go with tests for helper types and functions
* Adds unittests for loginHandle