configurations_test.go | |
---|---|
|
|
Documentation in literate-programming-style is available at: https://redhatinsights.github.io/insights-operator-cli/packages/commands/configurations_test.html |
|
tryToFindConfiguration function checks if the error message about unable to find configuration is displayed on standard output or not. |
|
TODO: make the string configurable |
|
changeDirectory function tries to change current directory with additional test whether the operation has been correct or not. |
|
it is expected that the "change dir" operation is successful |
|
TestListOfConfigurations unit test checks whether the non-empty list of configurations read via REST API is displayed correctly |
|
turn off any colorization on standard output |
|
use mocked REST API instead of the real one |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|
Mocked REST API returns three configurations, so we expect at least one caption + 3 other lines in the output |
|
TestListOfConfigurationsEmptyList checks whether the empty list of configurations read via REST API is displayed correctly |
|
turn off any colorization on standard output |
|
use mocked REST API instead of the real one |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|
Mocked REST API returns empty list, so just one caption + one message is expected |
|
TestListOfConfigurationsErrorHandling checks whether error returned by REST API is handled correctly |
|
turn off any colorization on standard output |
|
use mocked REST API instead of the real one |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|
TestDeleteClusterConfiguration checks the command 'delete configuration' |
|
turn off any colorization on standard output |
|
use mocked REST API instead of the real one |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|
TestDeleteClusterConfigurationError checks the command 'delete configuration' when error is reported by REST API |
|
turn off any colorization on standard output |
|
use mocked REST API instead of the real one |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|
TestEnableClusterConfiguration checks the command 'enable configuration' |
|
turn off any colorization on standard output |
|
use mocked REST API instead of the real one |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|
TestEnableClusterConfigurationError checks the command 'enable configuration' when error is reported by REST API |
|
turn off any colorization on standard output |
|
use mocked REST API instead of the real one |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|
TestDisableClusterConfiguration checks the command 'disable configuration' |
|
turn off any colorization on standard output |
|
use mocked REST API instead of the real one |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|
TestDisableClusterConfigurationError checks the command 'disable configuration' when error is reported by REST API |
|
turn off any colorization on standard output |
|
use mocked REST API instead of the real one |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|
TestDescribeConfiguration checks the command 'describe configuration' |
|
turn off any colorization on standard output |
|
use mocked REST API instead of the real one |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|
TestDescribeConfigurationError checks the command 'describe configuration' when error is reported by REST API |
|
turn off any colorization on standard output |
|
use mocked REST API instead of the real one |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|
TestAddClusterConfigurationImpl checks the command 'add configuration' |
|
turn off any colorization on standard output |
|
use mocked REST API instead of the real one |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|
TestAddClusterConfigurationImplError checks the command 'add configuration' when REST API fails with error |
|
turn off any colorization on standard output |
|
use mocked REST API instead of the real one |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|
TestAddClusterConfigurationImplBadConfiguration checks the command 'add configuration' for non-existing configuration file |
|
turn off any colorization on standard output |
|
use mocked REST API instead of the real one |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|