2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 05:55:28 +00:00

[master] Add lettuce test for mixed-case query

This commit is contained in:
Mukund Sivaraman
2013-11-07 18:22:42 +05:30
parent 4655c110af
commit d6d7f7d201
2 changed files with 38 additions and 5 deletions

View File

@@ -132,6 +132,36 @@ Feature: Example feature
A query for www.example.org to 127.0.0.1:47806 should have rcode NOERROR
A query for www.example.org type A class IN to 127.0.0.1:47806 should have rcode NOERROR
Scenario: example.org mixed-case query
# This scenario performs a mixed-case query and checks that the
# response has the name copied from the question exactly
# (without any change in case). For why this is necessary, see
# section 5.2 of:
# http://tools.ietf.org/html/draft-vixie-dnsext-dns0x20-00
Given I have bind10 running with configuration example.org.config
And wait for bind10 stderr message BIND10_STARTED_CC
And wait for bind10 stderr message CMDCTL_STARTED
And wait for bind10 stderr message AUTH_SERVER_STARTED
bind10 module Auth should be running
And bind10 module Resolver should not be running
And bind10 module Xfrout should not be running
And bind10 module Zonemgr should not be running
And bind10 module Xfrin should not be running
And bind10 module Stats should not be running
And bind10 module StatsHttpd should not be running
A query for wWw.eXaMpLe.Org should have rcode NOERROR
The last query response should have qdcount 1
The last query response should have ancount 1
The last query response should have nscount 3
The last query response should have adcount 0
The question section of the last query response should exactly be
"""
;wWw.eXaMpLe.Org. IN A
"""
Scenario: changing database
# This scenario contains a lot of 'wait for' steps
# If those are not present, the asynchronous nature of the application

View File

@@ -110,6 +110,8 @@ class QueryResult(object):
self.line_handler = self.parse_answer
elif line == ";; OPT PSEUDOSECTION:\n":
self.line_handler = self.parse_opt
elif line == ";; QUESTION SECTION:\n":
self.line_handler = self.parse_question
elif line == ";; AUTHORITY SECTION:\n":
self.line_handler = self.parse_authority
elif line == ";; ADDITIONAL SECTION:\n":
@@ -290,8 +292,8 @@ def check_last_query(step, item, value):
assert str(value) == str(lq_val),\
"Got: " + str(lq_val) + ", expected: " + str(value)
@step('([a-zA-Z]+) section of the last query response should be')
def check_last_query_section(step, section):
@step('([a-zA-Z]+) section of the last query response should (exactly )?be')
def check_last_query_section(step, section, exact):
"""
Check the entire contents of the given section of the response of the last
query.
@@ -330,9 +332,10 @@ def check_last_query_section(step, section):
# replace whitespace of any length by one space
response_string = re.sub("[ \t]+", " ", response_string)
expect = re.sub("[ \t]+", " ", step.multiline)
# lowercase them
response_string = response_string.lower()
expect = expect.lower()
# lowercase them unless we need to do an exact match
if exact is None:
response_string = response_string.lower()
expect = expect.lower()
# sort them
response_string_parts = response_string.split("\n")
response_string_parts.sort()