Update authentication unit tests for the change to the cookies being  JSON encoded.
Add database unit tests. Fix some misspelled method names. Other formatting changes.