Refactor tests, use mocha mocking instead of homegrown.

Also test how supervisorctl is called