refactor rest tests