Added tests for password view function
Fix and refactor
Moved test to package