More tests and mocking.  Add 'cli' dependency.