Test master password validation

Required a refactoring.
wrap a line
Test createAccountPassword() and related functions

Required refactoring and adding tests for setAccountPassword().