diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2018-08-30 17:58:07 +0200 |
---|---|---|
committer | Thomas Huth <thuth@redhat.com> | 2018-08-31 09:53:10 +0200 |
commit | ebb4d82d88810c31cb5eee408e1ac6d319f7f9bb (patch) | |
tree | 3c58c804ec1f08f2da77bd3cae154caeb894947a /tests/drive_del-test.c | |
parent | b8e1f74b0a258db394a35272a44d14ec0b6e0be9 (diff) |
tests: add qmp_assert_error_class()
This helper will simplify a bunch of code checking for QMP errors and
can be shared by various tests. Note that test-qga does check for
error description as well, so don't replace the code there for now.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/drive_del-test.c')
-rw-r--r-- | tests/drive_del-test.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/tests/drive_del-test.c b/tests/drive_del-test.c index 673c10140f..4a1a0889c8 100644 --- a/tests/drive_del-test.c +++ b/tests/drive_del-test.c @@ -67,7 +67,6 @@ static void test_after_failed_device_add(void) { char driver[32]; QDict *response; - QDict *error; snprintf(driver, sizeof(driver), "virtio-blk-%s", qvirtio_get_dev_type()); @@ -83,9 +82,7 @@ static void test_after_failed_device_add(void) " 'drive': 'drive0'" "}}", driver); g_assert(response); - error = qdict_get_qdict(response, "error"); - g_assert_cmpstr(qdict_get_try_str(error, "class"), ==, "GenericError"); - qobject_unref(response); + qmp_assert_error_class(response, "GenericError"); /* Delete the drive */ drive_del(); |