Skip to content

Commit

Permalink
mussel: add show_password to instance.
Browse files Browse the repository at this point in the history
  • Loading branch information
hansode committed Jul 18, 2015
1 parent 35e0616 commit 3adf330
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
7 changes: 7 additions & 0 deletions client/mussel/test/component/v12.03/t.instance.sh
Expand Up @@ -360,6 +360,13 @@ function test_instance_backup_volume() {

}

### show-password

function test_instance_show_password() {
assertEquals "curl -X GET $(base_uri)/${namespace}s/${uuid}/password.$(suffix)" \
"$(cli_wrapper ${namespace} 'show_password' ${uuid})"
}

### update

function test_instance_update() {
Expand Down
18 changes: 17 additions & 1 deletion client/mussel/test/unit/v12.03/t.instance.sh
Expand Up @@ -25,7 +25,7 @@ function setUp() {
function test_instance_help_stderr_to_stdout_success() {
extract_args ${namespace} help
res=$(run_cmd ${MUSSEL_ARGS} 2>&1)
assertEquals "$0 ${namespace} [help|backup|backup_volume|create|destroy|index|move|poweroff|poweron|reboot|show|show_volumes|update|xcreate]" "${res}"
assertEquals "$0 ${namespace} [help|backup|backup_volume|create|destroy|index|move|poweroff|poweron|reboot|show|show_password|show_volumes|update|xcreate]" "${res}"
}

### index
Expand Down Expand Up @@ -145,6 +145,22 @@ function test_instance_update_uuid() {
assertEquals 0 $?
}

### show_password

function test_instance_show_password_no_uuid() {
extract_args ${namespace} show_password
run_cmd ${MUSSEL_ARGS} 2>/dev/null
assertNotEquals 0 $?
}

function test_instance_show_password_uuid() {
extract_args ${namespace} show_password i-xxx
run_cmd ${MUSSEL_ARGS}
assertEquals 0 $?
}

## shunit2

## shunit2

. ${shunit2_file}
9 changes: 9 additions & 0 deletions client/mussel/v12.03.d/instance.sh
Expand Up @@ -122,3 +122,12 @@ task_update() {
) \
$(base_uri)/${namespace}s/${uuid}.$(suffix)
}

task_show_password() {
local namespace=$1 cmd=$2 uuid=$3
[[ -n "${namespace}" ]] || { echo "[ERROR] 'namespace' is empty (${BASH_SOURCE[0]##*/}:${LINENO})" >&2; return 1; }
[[ -n "${cmd}" ]] || { echo "[ERROR] 'cmd' is empty (${BASH_SOURCE[0]##*/}:${LINENO})" >&2; return 1; }
[[ -n "${uuid}" ]] || { echo "[ERROR] 'uuid' is empty (${BASH_SOURCE[0]##*/}:${LINENO})" >&2; return 1; }

call_api -X GET $(base_uri)/${namespace}s/${uuid}/password.$(suffix)
}

0 comments on commit 3adf330

Please sign in to comment.