Move some functions to cli.
Server must be started to run tests on Travis.