mirror of
https://github.com/systemd/systemd.git
synced 2026-08-05 07:30:30 +00:00
resolved: tests for dns_resource_key_{to,from}_json()
This test doesn't check the generated JSON data in detail, it simply tests that round-tripping an RR key through the JSON representation preserves its data.
This commit is contained in:
committed by
Luca Boccassi
parent
1500512f23
commit
7b59f2ada4
@@ -697,6 +697,26 @@ TEST(dns_resource_key_to_string) {
|
||||
ASSERT_STREQ(ans, "www.example.com IN CNAME");
|
||||
}
|
||||
|
||||
/* ================================================================
|
||||
* dns_resource_key_{to,from}_json()
|
||||
* ================================================================ */
|
||||
|
||||
TEST(dns_resource_key_from_json) {
|
||||
_cleanup_(dns_resource_key_unrefp) DnsResourceKey *key = NULL, *copy = NULL;
|
||||
_cleanup_(sd_json_variant_unrefp) sd_json_variant *json = NULL;
|
||||
|
||||
key = dns_resource_key_new(DNS_CLASS_IN, DNS_TYPE_A, "www.example.com");
|
||||
ASSERT_NOT_NULL(key);
|
||||
|
||||
ASSERT_OK(dns_resource_key_to_json(key, &json));
|
||||
ASSERT_NOT_NULL(json);
|
||||
|
||||
ASSERT_OK(dns_resource_key_from_json(json, ©));
|
||||
ASSERT_EQ(copy->class, DNS_CLASS_IN);
|
||||
ASSERT_EQ(copy->type, DNS_TYPE_A);
|
||||
ASSERT_STREQ(dns_resource_key_name(copy), "www.example.com");
|
||||
}
|
||||
|
||||
/* ================================================================
|
||||
* dns_resource_key_reduce()
|
||||
* ================================================================ */
|
||||
|
||||
Reference in New Issue
Block a user