profiles_test.go | |
---|---|
|
|
Unit tests checking functions for manipulation with profiles via REST API. |
|
Documentation in literate-programming-style is available at: https://redhatinsights.github.io/insights-operator-cli/packages/commands/profiles_test.html |
|
tryToFindProfile is a helper function that tries to find a given profile in captured output. If profile info is not found, the test that calls this function, fails. |
|
if profile info is not found, the test should fail |
|
TestListOfProfiles function checks whether the non-empty list of configuration profiles read via REST API is displayed correctly. |
|
turn off any colorization on standard output so we'll be able to capture pure messages w/o terminal control codes |
|
use mocked REST API instead of the real one to perform profile-related command or query |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|
we expect four lines - title, column headers and two configuration profiles |
|
list of expected profiles to be displayed on standard output |
|
check the actual output displayed on terminal |
|
TestListOfProfilesNoProfiles function checks whether the empty list of configuration profiles read via REST API is displayed correctly. |
|
turn off any colorization on standard output so we'll be able to capture pure messages w/o terminal control codes |
|
use mocked REST API instead of the real one to perform profile-related command or query |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|
we expect two lines - title and column headers |
|
check the actual output displayed on terminal |
|
TestListOfProfilesNoProfiles function checks whether error returned by REST API is handled correctly. |
|
turn off any colorization on standard output so we'll be able to capture pure messages w/o terminal control codes |
|
use mocked REST API instead of the real one to perform profile-related command or query |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|
TestDescribeProfile function checks how the configuration profile is displayed on CLI. |
|
turn off any colorization on standard output so we'll be able to capture pure messages w/o terminal control codes |
|
use mocked REST API instead of the real one to perform profile-related command or query |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|
configuration profile needs to be displayed |
|
TestDescribeProfile function checks error handling of REST API. |
|
turn off any colorization on standard output so we'll be able to capture pure messages w/o terminal control codes |
|
use mocked REST API instead of the real one to perform profile-related command or query |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|
TestAddConfigurationProfileImpl function checks the command 'add profile' when no error is reported by REST API. |
|
turn off any colorization on standard output so we'll be able to capture pure messages w/o terminal control codes |
|
use mocked REST API instead of the real one to perform profile-related command or query |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|
TestAddConfigurationProfileImplWrongConfiguration function checks the command 'add profile' when configuration file does not exist. |
|
turn off any colorization on standard output so we'll be able to capture pure messages w/o terminal control codes |
|
use mocked REST API instead of the real one to perform profile-related command or query |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|
TestAddConfigurationProfileImplErrorHandling function checks the command 'add profile' when error is reported by REST API. |
|
turn off any colorization on standard output so we'll be able to capture pure messages w/o terminal control codes |
|
use mocked REST API instead of the real one to perform profile-related command or query |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|
TestDeleteConfigurationProfile function checks the command 'delete profile' when no error is reported by REST API. |
|
turn off any colorization on standard output so we'll be able to capture pure messages w/o terminal control codes |
|
use mocked REST API instead of the real one to perform profile-related command or query |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|
TestDeleteConfigurationProfile function checks the command 'delete profile' when error is reported by REST API. |
|
turn off any colorization on standard output so we'll be able to capture pure messages w/o terminal control codes |
|
use mocked REST API instead of the real one to perform profile-related command or query |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|
TestDeleteConfigurationProfileNoConfirm function checks the command 'delete profile' when no error is reported by REST API. |
|
turn off any colorization on standard output so we'll be able to capture pure messages w/o terminal control codes |
|
use mocked REST API instead of the real one to perform profile-related command or query |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|
TestDeleteConfigurationProfileNoConfirm function checks the command 'delete profile' when error is reported by REST API. |
|
turn off any colorization on standard output so we'll be able to capture pure messages w/o terminal control codes |
|
use mocked REST API instead of the real one to perform profile-related command or query |
|
use go-capture package to capture all writes to standard output |
|
check if capture was done correctly |
|
test the captured output |
|