cli: Separate URL constructing code

This construction code will be used in testing to mock API requests.

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cli: Add testing module and test command function

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cli: Add -T,--test flag to test commands

Running the CLI with -T (--test) providing a command name will run the tests
for the requested command. Also, set console size to 24x80 to enable
an expected consistent output formatting.

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cli: Enable mocking of OSv API for testing

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cli: Add test for echo command

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cli: Add test for dmesg

Fix dmesg to be testable (replace print()).

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cli: Add test for cat

Fix cat to be testable (replace print())

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cli: Add test for cd

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cli: Add test for date

Fix date to make it testable (replace print())

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cli: Add test for df

Make df testable (replace print())

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cli: Add test for free

Make free testable (replace print())

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cli: Add test for mkdir

Also: Fix mkdir. ;-)

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cli: Add test for rm

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cli: Add test for ls

Make ls testable (replace print())

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
setup.py: install p11-kit package

Build failure fixed by this patch:

make[2]: Entering directory '/mnt/jenkins/workspace/cassandra-ec2-perf/modules/ca-certificates'
mkdir -p build/etc/pki/ca-trust/extracted/openssl
  CC tests/tst-bsd-kthread.so
mkdir -p build/etc/pki/ca-trust/extracted/pem
mkdir -p build/etc/pki/ca-trust/extracted/java
p11-kit extract --format=openssl-bundle --filter=certificates --overwrite build/etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt
make[2]: p11-kit: Command not found
Makefile:5: recipe for target 'module' failed
make[2]: *** [module] Error 127
make[2]: Leaving directory '/mnt/jenkins/workspace/cassandra-ec2-perf/modules/ca-certificates'

Reviewed-by: Tomasz Grabiec <tgrabiec@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>