Refactor test
Add helper func to set logged in user in lib, for tests