7f14edd039
=====================================================================
Excited to bring V5 to life. This includes some BREAKING CHANGES to
several aspects of ZSH-type scwrypts. Please refer to the readme
for upgrade details (specifically docs/upgrade/v4-to-v5.md)
--- New Features -------------------------
- ZSH testing library with basic mock capabilities
- new scwrypts environment file format includes metadata and more
advanced features like optional parent env overrides, selection
inheritence, and improved structurual flexibility
- speedup cache for non-CI runs of ZSH-type scwrypts
- ${scwryptsmodule} syntax now allows a consistent unique-naming
scheme for functions in ZSH-type scwrypts while providing better
insight into origin of API calls in other modules
- reusable, case-statement-driven argument parsers in ZSH-type scwrypts
--- Changes ------------------------------
- several utility function renames in ZSH-type scwrypts to improve
consistency
- documentation comments included in ZSH libraries
- ZSH-type scwrypts now allow library modules to live alongside
executables
(zsh/lib still supported; autodetection determines default)
--- Bug Fixes ----------------------------
- hardened environment checking for REQUIRED_ENV variables; this removes
the ability to overwrite variables in local function contexts
66 lines
1.3 KiB
Bash
66 lines
1.3 KiB
Bash
#####################################################################
|
|
|
|
use unittest
|
|
testmodule=cloud.aws.cli
|
|
|
|
#####################################################################
|
|
|
|
beforeall() {
|
|
use cloud/aws/cli
|
|
}
|
|
|
|
beforeeach() {
|
|
unittest.mock aws
|
|
unittest.mock echo.debug
|
|
|
|
_ARGS=($(uuidgen) $(uuidgen) $(uuidgen))
|
|
|
|
_AWS_REGION=$(uuidgen)
|
|
_AWS_PROFILE=$(uuidgen)
|
|
|
|
unittest.mock.env AWS_ACCOUNT --value $(uuidgen)
|
|
unittest.mock.env AWS_PROFILE --value ${_AWS_PROFILE}
|
|
unittest.mock.env AWS_REGION --value ${_AWS_REGION}
|
|
}
|
|
|
|
aftereach() {
|
|
unset _AWS_REGION
|
|
unset _AWS_PROFILE
|
|
}
|
|
|
|
#####################################################################
|
|
|
|
test.forwards-arguments() {
|
|
${testmodule} ${_ARGS[@]}
|
|
|
|
aws.assert.callstack \
|
|
--output json \
|
|
--region ${_AWS_REGION} \
|
|
--profile ${_AWS_PROFILE} \
|
|
${_ARGS[@]} \
|
|
;
|
|
}
|
|
|
|
test.overrides-region() {
|
|
local OVERRIDE_REGION=$(uuidgen)
|
|
|
|
${testmodule} --region ${OVERRIDE_REGION} ${_ARGS[@]}
|
|
|
|
aws.assert.callstack \
|
|
--output json \
|
|
--region ${OVERRIDE_REGION} \
|
|
--profile ${_AWS_PROFILE} \
|
|
${_ARGS[@]} \
|
|
;
|
|
}
|
|
|
|
test.overrides-account() {
|
|
local OVERRIDE_ACCOUNT=$(uuidgen)
|
|
|
|
${testmodule} --account ${OVERRIDE_ACCOUNT} ${_ARGS[@]}
|
|
|
|
echo.debug.assert.callstackincludes \
|
|
AWS_ACCOUNT=${OVERRIDE_ACCOUNT} \
|
|
;
|
|
}
|