Do not treat StartRecordName and StartRecordType in the list_resource_record_sets as filters

According to AWS API reference and Boto documentation they are to begin the record listing from,
not for filtering. So their current behavior in moto is not consistent with AWS.
This commit is contained in:
Andrey Melentyev 2017-10-23 17:25:40 +02:00
commit 4e390530a7
3 changed files with 73 additions and 11 deletions

View file

@ -196,14 +196,14 @@ class FakeZone(BaseModel):
self.rrsets = [
record_set for record_set in self.rrsets if record_set.set_identifier != set_identifier]
def get_record_sets(self, type_filter, name_filter):
def get_record_sets(self, start_type, start_name):
record_sets = list(self.rrsets) # Copy the list
if type_filter:
if start_type:
record_sets = [
record_set for record_set in record_sets if record_set._type == type_filter]
if name_filter:
record_set for record_set in record_sets if record_set._type >= start_type]
if start_name:
record_sets = [
record_set for record_set in record_sets if record_set.name == name_filter]
record_set for record_set in record_sets if record_set.name >= start_name]
return record_sets

View file

@ -151,9 +151,9 @@ class Route53(BaseResponse):
elif method == "GET":
querystring = parse_qs(parsed_url.query)
template = Template(LIST_RRSET_REPONSE)
type_filter = querystring.get("type", [None])[0]
name_filter = querystring.get("name", [None])[0]
record_sets = the_zone.get_record_sets(type_filter, name_filter)
start_type = querystring.get("type", [None])[0]
start_name = querystring.get("name", [None])[0]
record_sets = the_zone.get_record_sets(start_type, start_name)
return 200, headers, template.render(record_sets=record_sets)
def health_check_response(self, request, full_url, headers):