'Runs the command in argv.
rpcs is a list of tuples, each representing one RPC:
(op, **dargs, success, expected)
exit_code should be set if you expect the command
to fail
The words are lists of words that are expected'

def run_cmd(self, argv, rpcs=[], exit_code=None, out_words_ok=[], out_words_no=[], err_words_ok=[], err_words_no=[]):

    sys.argv = argv
    self.mock_rpcs(rpcs)
    if (not (CLI_USING_PDB and CLI_UT_DEBUG)):
        self.god.mock_io()
    if (exit_code is not None):
        sys.exit.expect_call(exit_code).and_raises(ExitException)
        self.assertRaises(ExitException, atest.main)
    else:
        atest.main()
    (out, err) = self.god.unmock_io()
    self.god.check_playback()
    self._check_output(out, out_words_ok, out_words_no, err, err_words_ok, err_words_no)
    return (out, err)
