-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aa96f89
commit e8f2e6c
Showing
7 changed files
with
198 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,124 +1,83 @@ | ||
Describe 'awsprofile --doctor' | ||
Describe 'awsprofile doctor' | ||
|
||
# | ||
# basic checks | ||
# | ||
# | ||
# basic checks | ||
# | ||
|
||
Describe 'command responds' | ||
Describe 'command responds' | ||
|
||
It 'checks for the correct ouput' | ||
When call ./bin/awsprofile doctor | ||
The status should be success | ||
The output should include "Checking for required command line utilities" | ||
End | ||
|
||
End | ||
|
||
# | ||
# package checks | ||
# | ||
|
||
# basename | ||
|
||
Describe 'checks that utility basename is installed' | ||
|
||
It 'prints basename ok' | ||
When call ./bin/awsprofile doctor | ||
The status should be success | ||
The output should include "[ok] basename" | ||
End | ||
It 'checks for the correct ouput' | ||
When call ./bin/awsprofile doctor | ||
The status should be success | ||
The output should include "Checking for required command line utilities" | ||
End | ||
|
||
command() { return 1; } | ||
|
||
It 'prints basename failed' | ||
When run source ./bin/awsprofile doctor | ||
The status should be success | ||
The output should include "[failed] basename" | ||
End | ||
|
||
End | ||
|
||
# find | ||
# | ||
# package checks | ||
# | ||
|
||
Describe 'checks required utilities are installed' | ||
|
||
It 'prints ok basename' | ||
When call ./bin/awsprofile doctor | ||
The status should be success | ||
The output should include "[ok] basename" | ||
End | ||
|
||
It 'prints ok find' | ||
When call ./bin/awsprofile doctor | ||
The status should be success | ||
The output should include "[ok] find" | ||
End | ||
|
||
It 'prints ok readlink' | ||
When call ./bin/awsprofile doctor | ||
The status should be success | ||
The output should include "[ok] readlink" | ||
End | ||
|
||
It 'prints ok realpath' | ||
When call ./bin/awsprofile doctor | ||
The status should be success | ||
The output should include "[ok] realpath" | ||
End | ||
|
||
It 'prints credentials should not exist ok' | ||
When call ./bin/awsprofile doctor | ||
The status should be success | ||
The output should include "[ok] credentials should not exist" | ||
End | ||
|
||
It 'prints credentials should not exist ok' | ||
When call ./bin/awsprofile doctor | ||
The status should be success | ||
The output should include "[ok] credentials should not exist" | ||
End | ||
|
||
# Intercept begin | ||
# __begin__() { | ||
# test() { | ||
# if [ "$1" = "-f" ] && [ "$2" = "$HOME/.aws/credentials" ]; then | ||
# return 0 | ||
# else | ||
# return 1 | ||
# fi | ||
# } | ||
# } | ||
|
||
# It 'prints credentials should not exist' | ||
# When run source ./bin/awsprofile --doctor | ||
# The output should include "$(printf "credentials should not exist [failed]")" | ||
# End | ||
|
||
It 'prints config should not exist ok' | ||
When call ./bin/awsprofile doctor | ||
The status should be success | ||
The output should include "[ok] config should not exist" | ||
End | ||
|
||
Describe 'checks that utility find is installed' | ||
|
||
It 'prints find ok' | ||
When call ./bin/awsprofile doctor | ||
The status should be success | ||
The output should include "[ok] find" | ||
End | ||
|
||
# command() { return 1; } | ||
Mock test_if_utility_installed | ||
if [ "$1" = "find" ]; then | ||
exit 1 | ||
else | ||
echo "command: command not found" >&2 | ||
exit 127 | ||
fi | ||
End | ||
|
||
# It 'prints find failed' | ||
# When run source ./bin/awsprofile doctor | ||
# The status should be success | ||
# The output should include "$(printf "find [failed]")" | ||
# End | ||
|
||
# It 'prints correct output' | ||
# When call test_if_utility_installed "dsds" | ||
# The status should be failure | ||
# End | ||
|
||
End | ||
|
||
Describe 'others tests' | ||
|
||
It 'prints readlink ok' | ||
When call ./bin/awsprofile doctor | ||
The status should be success | ||
The output should include "[ok] readlink" | ||
End | ||
|
||
It 'prints realpath ok' | ||
When call ./bin/awsprofile doctor | ||
The status should be success | ||
The output should include "[ok] realpath" | ||
End | ||
|
||
It 'prints credentials should not exist ok' | ||
When call ./bin/awsprofile doctor | ||
The status should be success | ||
The output should include "[ok] credentials should not exist" | ||
End | ||
|
||
It 'prints credentials should not exist ok' | ||
When call ./bin/awsprofile doctor | ||
The status should be success | ||
The output should include "[ok] credentials should not exist" | ||
End | ||
|
||
# Intercept begin | ||
# __begin__() { | ||
# test() { | ||
# if [ "$1" = "-f" ] && [ "$2" = "$HOME/.aws/credentials" ]; then | ||
# return 0 | ||
# else | ||
# return 1 | ||
# fi | ||
# } | ||
# } | ||
|
||
# It 'prints credentials should not exist' | ||
# When run source ./bin/awsprofile --doctor | ||
# The output should include "$(printf "credentials should not exist [failed]")" | ||
# End | ||
|
||
It 'prints config should not exist ok' | ||
When call ./bin/awsprofile doctor | ||
The status should be success | ||
The output should include "[ok] config should not exist" | ||
End | ||
|
||
End | ||
|
||
End |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
Describe 'awsprofile --help' | ||
Describe 'awsprofile help' | ||
|
||
Describe 'help command' | ||
It 'prints help information' | ||
When call ./bin/awsprofile help | ||
The status should be success | ||
The output should include "awsprofile <command> [options]" | ||
Describe 'help command' | ||
It 'prints help information' | ||
When call ./bin/awsprofile help | ||
The status should be success | ||
The output should include "awsprofile <command> [options]" | ||
End | ||
End | ||
End | ||
|
||
End |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Describe 'awsprofile initial-setup' | ||
|
||
Describe 'initial-setup command' | ||
It 'prints initial setup instructions' | ||
When call ./bin/awsprofile initial-setup | ||
The status should be success | ||
The output should include "Take the content from these files:" | ||
End | ||
End | ||
|
||
End |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,96 @@ | ||
Describe 'awsprofile' | ||
|
||
Describe 'no command provided' | ||
It 'prints an warning that no command was provided' | ||
When call ./bin/awsprofile | ||
The status should be failure | ||
The output should include "** Warning **" | ||
Include bin/awsprofile | ||
|
||
Describe 'no command provided' | ||
It 'prints an warning that no command was provided' | ||
When call ./bin/awsprofile | ||
The status should be failure | ||
The output should include "** Warning **" | ||
End | ||
End | ||
|
||
Describe 'arrow_icon()' | ||
It 'outputs arrow icon and provided text' | ||
When call arrow_icon test | ||
The line 1 should eq "${BOLD}${YELLOW} ⇒ ${RESET}test" | ||
The lines of output should eq 1 | ||
End | ||
End | ||
|
||
Describe 'print_warning()' | ||
It 'outputs warning text' | ||
When call print_warning test | ||
The line 1 should eq "${BOLD}${YELLOW}** Warning **${RESET}" | ||
The line 2 should eq "test" | ||
The lines of output should eq 2 | ||
End | ||
End | ||
|
||
Describe 'print_error()' | ||
It 'outputs error text' | ||
When call print_error test | ||
The line 1 should eq "${BOLD}${RED}** Error **${RESET}" | ||
The line 2 should eq "test" | ||
The lines of output should eq 2 | ||
End | ||
End | ||
|
||
Describe 'ok()' | ||
It 'outputs [ok]' | ||
When call ok | ||
The line 1 should eq "${BOLD}${GREEN}[ok]${RESET}" | ||
The lines of output should eq 1 | ||
End | ||
End | ||
|
||
Describe 'failed()' | ||
It 'outputs [failed]' | ||
When call failed | ||
The line 1 should eq "${BOLD}${RED}[failed]${RESET}" | ||
The lines of output should eq 1 | ||
End | ||
End | ||
|
||
Describe 'error()' | ||
It 'outputs [error]' | ||
When call error | ||
The line 1 should eq "${BOLD}${RED}[error]${RESET}" | ||
The lines of output should eq 1 | ||
End | ||
End | ||
|
||
# Describe 'get_profiles()' | ||
# It 'outputs profile information' | ||
# When call get_profiles | ||
# The status should be success | ||
# End | ||
# End | ||
|
||
Describe 'no_command_provided()' | ||
It 'it tests as successful because no command was provided' | ||
When call no_command_provided | ||
The status should be success | ||
End | ||
|
||
It 'tests as failed because a command was provided' | ||
When call no_command_provided test | ||
The status should be failure | ||
End | ||
End | ||
|
||
Describe 'empty_input()' | ||
|
||
It 'it tests as successful because no input was provided' | ||
When call empty_input | ||
The status should be success | ||
End | ||
|
||
It 'tests as failed because a input was provided' | ||
When call empty_input test | ||
The status should be failure | ||
End | ||
|
||
End | ||
End | ||
|
||
End |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
Describe 'awsprofile --version' | ||
Describe 'awsprofile version' | ||
|
||
Describe 'version command' | ||
It 'prints version information' | ||
When call ./bin/awsprofile version | ||
The status should be success | ||
The output should include "__release_version__" | ||
Describe 'version command' | ||
It 'prints version information' | ||
When call ./bin/awsprofile version | ||
The status should be success | ||
The output should include "__release_version__" | ||
End | ||
End | ||
End | ||
|
||
End |