Browse Source

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
tags/0.6.0^2
Dmitry Galkin 7 months ago
parent
commit
9a0a360be0

+ 2
- 2
designate_tempest_plugin/data_utils.py View File

@@ -169,7 +169,7 @@ def rand_mx_recordset(zone_name, pref=None, host=None, **kwargs):
169 169
 
170 170
 
171 171
 def rand_spf_recordset(zone_name, data=None, **kwargs):
172
-    data = data or "v=spf1 +all"
172
+    data = data or '"v=spf1 +all"'
173 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
 
195 195
 def rand_txt_recordset(zone_name, data=None, **kwargs):
196
-    data = data or "v=spf1 +all"
196
+    data = data or '"v=spf1 +all"'
197 197
     return rand_recordset_data('TXT', zone_name, records=[data], **kwargs)
198 198
 
199 199
 

+ 1
- 1
designate_tempest_plugin/tests/api/v2/invalid_txt_dataset.json View File

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

+ 1
- 1
designate_tempest_plugin/tests/api/v2/recordset_data.json View File

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

+ 4
- 4
designate_tempest_plugin/tests/api/v2/recordset_wildcard_data.json View File

@@ -33,21 +33,21 @@
33 33
     "SPF at APEX": {
34 34
         "name": "*",
35 35
         "type": "SPF",
36
-        "records": ["v=spf1; a -all"]
36
+        "records": ["\"v=spf1; a -all\""]
37 37
     },
38 38
     "SPF under APEX": {
39 39
         "name": "*.sub",
40 40
         "type": "SPF",
41
-        "records": ["v=spf1; a -all"]
41
+        "records": ["\"v=spf1; a -all\""]
42 42
     },
43 43
     "TXT at APEX": {
44 44
         "name": "*",
45 45
         "type": "TXT",
46
-        "records": ["Can you read me?"]
46
+        "records": ["\"Can you read me?\""]
47 47
     },
48 48
     "TXT under APEX": {
49 49
         "name": "*.sub",
50 50
         "type": "TXT",
51
-        "records": ["Can you read me?"]
51
+        "records": ["\"Can you read me?\""]
52 52
     }
53 53
 }

+ 1
- 1
designate_tempest_plugin/tests/api/v2/test_recordset_validation.py View File

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

+ 3
- 3
designate_tempest_plugin/tests/api/v2/valid_txt_dataset.json View File

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

+ 1
- 1
designate_tempest_plugin/tests/base.py View File

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

Loading…
Cancel
Save