Fix flaky unit test by mocking what's necessary (bug 997942)