def test_command_execute_get_dbs(stc, tmpdir, meth_mgr):
    global PKG, COMMAND, COMMAND_NAME, TEST_MULTIPLE_DB_FILE

    # FIXME: Do the various checks to ensure the db file's result are properly
    # loaded into the JSON string
    result_file = os.path.join(os.getcwd(), TEST_MULTIPLE_DB_FILE)

    db_list = []

    with AutoCommand('.'.join([PKG, COMMAND_NAME])) as cmd:
        export_to_json.get_this_cmd = MagicMock(return_value=cmd)
        export_to_json.get_active_results_db = MagicMock(return_value=result_file)
        db_list = export_to_json.get_dbs("SUMMARY")
        assert len(db_list) == 1
        assert db_list[0].endswith(TEST_MULTIPLE_DB_FILE)
        db_list = export_to_json.get_dbs("LAST_ITERATION")
        assert len(db_list) == 1
        assert db_list[0].endswith(TEST_MULTIPLE_DB_ITR_FILE)
        db_list = export_to_json.get_dbs("ALL_ITERATION")
        assert len(db_list) > 1
        # Verify error case
        exceptionError = ""
        try:
            export_to_json.get_dbs("nothing")
        except Exception, e:
            exceptionError = str(e)
        assert exceptionError == "Invalid database selected: nothing"