refactor server test to be a bit more dry