Tests: Fix returning errors from "keys" command and check selected