From: Mukund Sivaraman Date: Thu, 7 Nov 2013 12:52:42 +0000 (+0530) Subject: [master] Add lettuce test for mixed-case query X-Git-Tag: bind10-1.2.0beta1-release~102^2~29 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d6d7f7d201eb0dcfbcfda4e8589b556b596e826b;p=thirdparty%2Fkea.git [master] Add lettuce test for mixed-case query --- diff --git a/tests/lettuce/features/example.feature b/tests/lettuce/features/example.feature index ee84b46574..48cef20ea9 100644 --- a/tests/lettuce/features/example.feature +++ b/tests/lettuce/features/example.feature @@ -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 diff --git a/tests/lettuce/features/terrain/querying.py b/tests/lettuce/features/terrain/querying.py index ec75490510..d585e5e044 100644 --- a/tests/lettuce/features/terrain/querying.py +++ b/tests/lettuce/features/terrain/querying.py @@ -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()