Properly quote TXT/SPF sample data

(Check TXT/SPF records for RFC1035 sec. 5.1.)

Adds quotes and escape for quotes across the TXT/SPF data sets and tests.

Needed-By: https://review.openstack.org/#/c/555398
Change-Id: I5c8160a1cd4a41c4931ab852d478753bb98f4b7d
Closes-Bug: 1755788
This commit is contained in:
Dmitry Galkin 2018-11-13 19:42:29 +00:00 committed by Jens Harbott
parent fd1eb9bbbc
commit 9a0a360be0
7 changed files with 13 additions and 13 deletions

View File

@ -169,7 +169,7 @@ def rand_mx_recordset(zone_name, pref=None, host=None, **kwargs):
def rand_spf_recordset(zone_name, data=None, **kwargs):
data = data or "v=spf1 +all"
data = data or '"v=spf1 +all"'
return rand_recordset_data('SPF', zone_name, records=[data], **kwargs)
@ -193,7 +193,7 @@ def rand_sshfp_recordset(zone_name, algorithm_number=None,
def rand_txt_recordset(zone_name, data=None, **kwargs):
data = data or "v=spf1 +all"
data = data or '"v=spf1 +all"'
return rand_recordset_data('TXT', zone_name, records=[data], **kwargs)

View File

@ -1,5 +1,5 @@
{
"trailing_slash": {"data": "\\"},
"trailing_double_slash": {"data": "\\\\"},
"trailing_slash_after_text": {"data": "v=spf1 +all\\"}
"trailing_slash_after_text": {"data": "testtext\\"}
}

View File

@ -47,6 +47,6 @@
"TXT": {
"name": "www",
"type": "TXT",
"records": ["Any Old Text Goes Here"]
"records": ["\"Any Old Text Goes Here\""]
}
}

View File

@ -33,21 +33,21 @@
"SPF at APEX": {
"name": "*",
"type": "SPF",
"records": ["v=spf1; a -all"]
"records": ["\"v=spf1; a -all\""]
},
"SPF under APEX": {
"name": "*.sub",
"type": "SPF",
"records": ["v=spf1; a -all"]
"records": ["\"v=spf1; a -all\""]
},
"TXT at APEX": {
"name": "*",
"type": "TXT",
"records": ["Can you read me?"]
"records": ["\"Can you read me?\""]
},
"TXT under APEX": {
"name": "*.sub",
"type": "TXT",
"records": ["Can you read me?"]
"records": ["\"Can you read me?\""]
}
}

View File

@ -132,7 +132,7 @@ class RecordsetValidationTest(base.BaseDnsV2Test):
self.assertRaisesDns(
exceptions.BadRequest, 'invalid_object', 400,
self.recordset_client.create_recordset,
self.zone['id'], post_model,
self.zone['id'], post_model
)
@decorators.idempotent_id('03e4f811-0c37-4ce2-8b16-662c824f8f18')

View File

@ -1,5 +1,5 @@
{
"slash_with_one_trailing_space": {"data": "\\ "},
"slash_with_many_trailing_space": {"data": "\\ "},
"text_with_slash_and_trailing_space": {"data": "the txts "}
"slash_with_one_trailing_space": {"data": "\"\\ \""},
"slash_with_many_trailing_space": {"data": "\"\\ \""},
"text_with_slash_and_trailing_space": {"data": "\"the txts \""}
}

View File

@ -21,7 +21,7 @@ from designate_tempest_plugin import clients
CONF = config.CONF
class AssertRaisesDns(object):
class AssertRaisesDns(test.BaseTestCase):
def __init__(self, test_class, exc, type_, code):
self.test_class = test_class
self.exc = exc