summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Galkin <galkindmitrii@gmail.com>2018-11-13 19:42:29 +0000
committerJens Harbott <j.harbott@x-ion.de>2019-03-13 14:37:49 +0000
commit9a0a360be06e06a7f2d08ab5c28ccdb5dd9dfc87 (patch)
tree69875d8e1b84e90b42294c92005ae0b97a958f23
parentfd1eb9bbbcb721b4f8e7021219b5bdbd7c104ccb (diff)
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
Notes
Notes (review): Review-Priority+1: Graham Hayes <gr@ham.ie> Code-Review+2: Jens Harbott (frickler) <j.harbott@x-ion.de> Code-Review+2: Graham Hayes <gr@ham.ie> Workflow+1: Graham Hayes <gr@ham.ie> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Thu, 14 Mar 2019 17:51:12 +0000 Reviewed-on: https://review.openstack.org/617809 Project: openstack/designate-tempest-plugin Branch: refs/heads/master
-rw-r--r--designate_tempest_plugin/data_utils.py4
-rw-r--r--designate_tempest_plugin/tests/api/v2/invalid_txt_dataset.json2
-rw-r--r--designate_tempest_plugin/tests/api/v2/recordset_data.json2
-rw-r--r--designate_tempest_plugin/tests/api/v2/recordset_wildcard_data.json8
-rw-r--r--designate_tempest_plugin/tests/api/v2/test_recordset_validation.py2
-rw-r--r--designate_tempest_plugin/tests/api/v2/valid_txt_dataset.json6
-rw-r--r--designate_tempest_plugin/tests/base.py2
7 files changed, 13 insertions, 13 deletions
diff --git a/designate_tempest_plugin/data_utils.py b/designate_tempest_plugin/data_utils.py
index 46c8165..2f61d97 100644
--- a/designate_tempest_plugin/data_utils.py
+++ b/designate_tempest_plugin/data_utils.py
@@ -169,7 +169,7 @@ def rand_mx_recordset(zone_name, pref=None, host=None, **kwargs):
169 169
170 170
171def rand_spf_recordset(zone_name, data=None, **kwargs): 171def rand_spf_recordset(zone_name, data=None, **kwargs):
172 data = data or "v=spf1 +all" 172 data = data or '"v=spf1 +all"'
173 return rand_recordset_data('SPF', zone_name, records=[data], **kwargs) 173 return rand_recordset_data('SPF', zone_name, records=[data], **kwargs)
174 174
175 175
@@ -193,7 +193,7 @@ def rand_sshfp_recordset(zone_name, algorithm_number=None,
193 193
194 194
195def rand_txt_recordset(zone_name, data=None, **kwargs): 195def rand_txt_recordset(zone_name, data=None, **kwargs):
196 data = data or "v=spf1 +all" 196 data = data or '"v=spf1 +all"'
197 return rand_recordset_data('TXT', zone_name, records=[data], **kwargs) 197 return rand_recordset_data('TXT', zone_name, records=[data], **kwargs)
198 198
199 199
diff --git a/designate_tempest_plugin/tests/api/v2/invalid_txt_dataset.json b/designate_tempest_plugin/tests/api/v2/invalid_txt_dataset.json
index 26633f3..449d90c 100644
--- a/designate_tempest_plugin/tests/api/v2/invalid_txt_dataset.json
+++ b/designate_tempest_plugin/tests/api/v2/invalid_txt_dataset.json
@@ -1,5 +1,5 @@
1{ 1{
2 "trailing_slash": {"data": "\\"}, 2 "trailing_slash": {"data": "\\"},
3 "trailing_double_slash": {"data": "\\\\"}, 3 "trailing_double_slash": {"data": "\\\\"},
4 "trailing_slash_after_text": {"data": "v=spf1 +all\\"} 4 "trailing_slash_after_text": {"data": "testtext\\"}
5} 5}
diff --git a/designate_tempest_plugin/tests/api/v2/recordset_data.json b/designate_tempest_plugin/tests/api/v2/recordset_data.json
index 5790c54..9f365a7 100644
--- a/designate_tempest_plugin/tests/api/v2/recordset_data.json
+++ b/designate_tempest_plugin/tests/api/v2/recordset_data.json
@@ -47,6 +47,6 @@
47 "TXT": { 47 "TXT": {
48 "name": "www", 48 "name": "www",
49 "type": "TXT", 49 "type": "TXT",
50 "records": ["Any Old Text Goes Here"] 50 "records": ["\"Any Old Text Goes Here\""]
51 } 51 }
52} 52}
diff --git a/designate_tempest_plugin/tests/api/v2/recordset_wildcard_data.json b/designate_tempest_plugin/tests/api/v2/recordset_wildcard_data.json
index dedf414..c56727d 100644
--- a/designate_tempest_plugin/tests/api/v2/recordset_wildcard_data.json
+++ b/designate_tempest_plugin/tests/api/v2/recordset_wildcard_data.json
@@ -33,21 +33,21 @@
33 "SPF at APEX": { 33 "SPF at APEX": {
34 "name": "*", 34 "name": "*",
35 "type": "SPF", 35 "type": "SPF",
36 "records": ["v=spf1; a -all"] 36 "records": ["\"v=spf1; a -all\""]
37 }, 37 },
38 "SPF under APEX": { 38 "SPF under APEX": {
39 "name": "*.sub", 39 "name": "*.sub",
40 "type": "SPF", 40 "type": "SPF",
41 "records": ["v=spf1; a -all"] 41 "records": ["\"v=spf1; a -all\""]
42 }, 42 },
43 "TXT at APEX": { 43 "TXT at APEX": {
44 "name": "*", 44 "name": "*",
45 "type": "TXT", 45 "type": "TXT",
46 "records": ["Can you read me?"] 46 "records": ["\"Can you read me?\""]
47 }, 47 },
48 "TXT under APEX": { 48 "TXT under APEX": {
49 "name": "*.sub", 49 "name": "*.sub",
50 "type": "TXT", 50 "type": "TXT",
51 "records": ["Can you read me?"] 51 "records": ["\"Can you read me?\""]
52 } 52 }
53} 53}
diff --git a/designate_tempest_plugin/tests/api/v2/test_recordset_validation.py b/designate_tempest_plugin/tests/api/v2/test_recordset_validation.py
index 0786811..a155f30 100644
--- a/designate_tempest_plugin/tests/api/v2/test_recordset_validation.py
+++ b/designate_tempest_plugin/tests/api/v2/test_recordset_validation.py
@@ -132,7 +132,7 @@ class RecordsetValidationTest(base.BaseDnsV2Test):
132 self.assertRaisesDns( 132 self.assertRaisesDns(
133 exceptions.BadRequest, 'invalid_object', 400, 133 exceptions.BadRequest, 'invalid_object', 400,
134 self.recordset_client.create_recordset, 134 self.recordset_client.create_recordset,
135 self.zone['id'], post_model, 135 self.zone['id'], post_model
136 ) 136 )
137 137
138 @decorators.idempotent_id('03e4f811-0c37-4ce2-8b16-662c824f8f18') 138 @decorators.idempotent_id('03e4f811-0c37-4ce2-8b16-662c824f8f18')
diff --git a/designate_tempest_plugin/tests/api/v2/valid_txt_dataset.json b/designate_tempest_plugin/tests/api/v2/valid_txt_dataset.json
index b54b1b3..3abcf10 100644
--- a/designate_tempest_plugin/tests/api/v2/valid_txt_dataset.json
+++ b/designate_tempest_plugin/tests/api/v2/valid_txt_dataset.json
@@ -1,5 +1,5 @@
1{ 1{
2 "slash_with_one_trailing_space": {"data": "\\ "}, 2 "slash_with_one_trailing_space": {"data": "\"\\ \""},
3 "slash_with_many_trailing_space": {"data": "\\ "}, 3 "slash_with_many_trailing_space": {"data": "\"\\ \""},
4 "text_with_slash_and_trailing_space": {"data": "the txts "} 4 "text_with_slash_and_trailing_space": {"data": "\"the txts \""}
5} 5}
diff --git a/designate_tempest_plugin/tests/base.py b/designate_tempest_plugin/tests/base.py
index e411597..bef19f2 100644
--- a/designate_tempest_plugin/tests/base.py
+++ b/designate_tempest_plugin/tests/base.py
@@ -21,7 +21,7 @@ from designate_tempest_plugin import clients
21CONF = config.CONF 21CONF = config.CONF
22 22
23 23
24class AssertRaisesDns(object): 24class AssertRaisesDns(test.BaseTestCase):
25 def __init__(self, test_class, exc, type_, code): 25 def __init__(self, test_class, exc, type_, code):
26 self.test_class = test_class 26 self.test_class = test_class
27 self.exc = exc 27 self.exc = exc