Fix EZP-21670: tests fixes and refactorings

JIRA issue: https://jira.ez.no/browse/EZP-21670

Mostly done.
One point where I'm not sure how to proceed is this one:

>> Usage of sinon.js in combination with Chai.js and sinon-chai could allow for more readable expectations. An alternative would be to create a bunch of own jasmine Matchers to test things like calls to the mocked connection manager.

@dpobel do you have any ideas in what exact way expectations readability could be improved?