Added unit tests, but they need additional mocking for encoding
password. Will do later.