mirror of https://github.com/getdnsapi/getdns.git
Make tests aware of NODATA == NO_NAME change
This commit is contained in:
parent
5247fc8de4
commit
431f86f414
|
@ -178,7 +178,7 @@
|
|||
{
|
||||
/*
|
||||
* name = "localhost" name should be resolved from host file
|
||||
* expect: NOERROR/NODATA response:
|
||||
* expect: NOERROR response:
|
||||
* status = GETDNS_RESPSTATUS_GOOD
|
||||
* rcode = 0
|
||||
* ancount = 1 (number of records in ANSWER section)
|
||||
|
|
|
@ -147,7 +147,7 @@
|
|||
/*
|
||||
* name = "willem.getdnsapi.net" need to replace this with domain from unbound zone
|
||||
* expect: NOERROR/NODATA response:
|
||||
* status = GETDNS_RESPSTATUS_GOOD
|
||||
* status = GETDNS_RESPSTATUS_NO_DATA
|
||||
* rcode = 0
|
||||
* ancount = 0 (number of records in ANSWER section)
|
||||
*/
|
||||
|
@ -162,6 +162,7 @@
|
|||
EXTRACT_RESPONSE;
|
||||
|
||||
assert_noerror(&ex_response);
|
||||
assert_nodata(&ex_response);
|
||||
//assert_soa_in_authority(&ex_response);
|
||||
|
||||
CONTEXT_DESTROY;
|
||||
|
|
|
@ -160,10 +160,15 @@ void extract_local_response(struct getdns_dict *response, struct extracted_respo
|
|||
void assert_noerror(struct extracted_response *ex_response)
|
||||
{
|
||||
uint32_t rcode;
|
||||
uint32_t ancount = 0;
|
||||
|
||||
ASSERT_RC(ex_response->status, GETDNS_RESPSTATUS_GOOD, "Unexpected value for \"status\"");
|
||||
ASSERT_RC(getdns_dict_get_int(ex_response->header, "rcode", &rcode), GETDNS_RETURN_GOOD, "Failed to extract \"rcode\"");
|
||||
ck_assert_msg(rcode == 0, "Expected rcode == 0, got %d", rcode);
|
||||
|
||||
ASSERT_RC(getdns_dict_get_int(ex_response->header, "ancount", &ancount),
|
||||
GETDNS_RETURN_GOOD, "Failed to extract \"ancount\"");
|
||||
|
||||
ASSERT_RC(ex_response->status, ((ancount > 0) ? GETDNS_RESPSTATUS_GOOD : GETDNS_RESPSTATUS_NO_NAME), "Unexpected value for \"status\"");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -182,6 +187,8 @@ void assert_nodata(struct extracted_response *ex_response)
|
|||
ASSERT_RC(getdns_list_get_length(ex_response->answer, &length),
|
||||
GETDNS_RETURN_GOOD, "Failed to extract \"answer\" length");
|
||||
ck_assert_msg(length == 0, "Expected \"answer\" length == 0, got %d", length);
|
||||
|
||||
ASSERT_RC(ex_response->status, GETDNS_RESPSTATUS_NO_NAME, "Unexpected value for \"status\"");
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -146,7 +146,7 @@
|
|||
* name = "google.com"
|
||||
* request_type = 0 (minimum valid RRTYPE)
|
||||
* expect: NOERROR/NODATA response:
|
||||
* status = GETDNS_RESPSTATUS_GOOD
|
||||
* status = GETDNS_RESPSTATUS_NO_NAME
|
||||
* rcode = 0
|
||||
* ancount = 0 (number of records in ANSWER section)
|
||||
*/
|
||||
|
@ -180,7 +180,7 @@
|
|||
* name = "google.com"
|
||||
* request_type = 65279 (maximum unassigned RRTYPE)
|
||||
* expect: NOERROR/NODATA response:
|
||||
* status = GETDNS_RESPSTATUS_GOOD
|
||||
* status = GETDNS_RESPSTATUS_NO_NAME
|
||||
* rcode = 0
|
||||
* ancount = 0 (number of records in ANSWER section)
|
||||
*/
|
||||
|
@ -322,7 +322,7 @@
|
|||
* name = "willem.getdnsapi.net" and unbound zone
|
||||
* request_type = GETDNS_RRTYPE_MX
|
||||
* expect: NOERROR/NODATA response:
|
||||
* status = GETDNS_RESPSTATUS_GOOD
|
||||
* status = GETDNS_RESPSTATUS_NO_NAME
|
||||
* rcode = 0
|
||||
* ancount = 0 (number of records in ANSWER section)
|
||||
*/
|
||||
|
|
|
@ -128,7 +128,7 @@
|
|||
* name = "google.com"
|
||||
* request_type = 0 (minimum valid RRTYPE)
|
||||
* expect: NOERROR/NODATA response:
|
||||
* status = GETDNS_RESPSTATUS_GOOD
|
||||
* status = GETDNS_RESPSTATUS_NO_NAME
|
||||
* rcode = 0
|
||||
* ancount = 0 (number of records in ANSWER section)
|
||||
*/
|
||||
|
@ -155,7 +155,7 @@
|
|||
* name = "google.com"
|
||||
* request_type = 65279 (maximum unassigned RRTYPE)
|
||||
* expect: NOERROR/NODATA response:
|
||||
* status = GETDNS_RESPSTATUS_GOOD
|
||||
* status = GETDNS_RESPSTATUS_NO_NAME
|
||||
* rcode = 0
|
||||
* ancount = 0 (number of records in ANSWER section)
|
||||
*/
|
||||
|
@ -269,7 +269,7 @@
|
|||
* name = "willem.getdnsapi.net" an unbound zone (as in no MX)
|
||||
* request_type = GETDNS_RRTYPE_MX
|
||||
* expect: NOERROR/NODATA response:
|
||||
* status = GETDNS_RESPSTATUS_GOOD
|
||||
* status = GETDNS_RESPSTATUS_NO_NAME
|
||||
* rcode = 0
|
||||
* ancount = 0 (number of records in ANSWER section)
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue