Test: Improved CLI testing infrastructure

Added a LoggingTerminal class to the infrastructure, which can be used
in tests, to make sure that CLI commands write out the right data
s/LogggingTerminal/LogggggggggingTerminal

Logging is a bit confusing (I'd expect it to use a logger)... how about `CapturingTerminal`?