Fixed problems of authentication in unit-testing