Revision 6d1e4845 qa/qa_utils.py

b/qa/qa_utils.py
410 410
                          utils.ShellQuoteArgs(cmd)).splitlines()
411 411

  
412 412

  
413
def GenericQueryTest(cmd, fields):
413
def GenericQueryTest(cmd, fields, namefield="name", test_unknown=True):
414 414
  """Runs a number of tests on query commands.
415 415

  
416 416
  @param cmd: Command name
......
426 426
  for testfields in _SelectQueryFields(rnd, fields):
427 427
    AssertCommand([cmd, "list", "--output", ",".join(testfields)])
428 428

  
429
  namelist_fn = compat.partial(_List, cmd, ["name"])
429
  namelist_fn = compat.partial(_List, cmd, [namefield])
430 430

  
431 431
  # When no names were requested, the list must be sorted
432 432
  names = namelist_fn(None)
......
440 440
  rnd.shuffle(randnames)
441 441
  AssertEqual(namelist_fn(randnames), randnames)
442 442

  
443
  # Listing unknown items must fail
444
  AssertCommand([cmd, "list", "this.name.certainly.does.not.exist"], fail=True)
443
  if test_unknown:
444
    # Listing unknown items must fail
445
    AssertCommand([cmd, "list", "this.name.certainly.does.not.exist"],
446
                  fail=True)
445 447

  
446 448
  # Check exit code for listing unknown field
447 449
  AssertEqual(AssertCommand([cmd, "list", "--output=field/does/not/exist"],

Also available in: Unified diff