[api] refactor application controller
[api] avoid duplicating the usernamd and password in all tests

Just use helper functions