Browse code

refactored test-cmd/edit to use new helper methods

Steve Kuznetsov authored on 2015/11/23 22:33:27
Showing 1 changed files
... ...
@@ -6,15 +6,16 @@ set -o pipefail
6 6
 
7 7
 OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8 8
 source "${OS_ROOT}/hack/util.sh"
9
+source "${OS_ROOT}/hack/cmd_util.sh"
9 10
 os::log::install_errexit
10 11
 
11 12
 # This test validates the edit command
12 13
 
13
-oc create -f examples/hello-openshift/hello-pod.json
14
+os::cmd::expect_success 'oc create -f examples/hello-openshift/hello-pod.json'
14 15
 
15
-[ "$(OC_EDITOR=cat oc edit pod/hello-openshift 2>&1 | grep 'Edit cancelled')" ]
16
-[ "$(OC_EDITOR=cat oc edit pod/hello-openshift | grep 'name: hello-openshift')" ]
17
-[ "$(OC_EDITOR=cat oc edit --windows-line-endings pod/hello-openshift | file - | grep CRLF)" ]
18
-[ ! "$(OC_EDITOR=cat oc edit --windows-line-endings=false pod/hello-openshift | file - | grep CRFL)" ]
16
+os::cmd::expect_success_and_text 'OC_EDITOR=cat oc edit pod/hello-openshift' 'Edit cancelled'
17
+os::cmd::expect_success_and_text 'OC_EDITOR=cat oc edit pod/hello-openshift' 'name: hello-openshift'
18
+os::cmd::expect_success_and_text 'OC_EDITOR=cat oc edit --windows-line-endings pod/hello-openshift | file -' 'CRLF'
19
+os::cmd::expect_success_and_not_text 'OC_EDITOR=cat oc edit --windows-line-endings=false pod/hello-openshift | file -' 'CRFL'
19 20
 echo "edit: ok"
20 21