14
14
if six .PY3 :
15
15
unicode = str
16
16
17
+ TEST_ZONE = u'zoneadd.%(domain)s' % api .env
18
+
17
19
18
20
@pytest .mark .tier0
19
21
class TestCLIParsing (object ):
@@ -123,9 +125,9 @@ def test_group_add_interactive(self):
123
125
all = False )
124
126
125
127
def test_dnsrecord_add (self ):
126
- self .check_command ('dnsrecord-add test-example.com ns --a-rec=1.2.3.4' ,
128
+ self .check_command ('dnsrecord-add %s ns --a-rec=1.2.3.4' % TEST_ZONE ,
127
129
'dnsrecord_add' ,
128
- dnszoneidnsname = u'test-example.com' ,
130
+ dnszoneidnsname = TEST_ZONE ,
129
131
idnsname = u'ns' ,
130
132
arecord = u'1.2.3.4' ,
131
133
structured = False ,
@@ -135,60 +137,60 @@ def test_dnsrecord_add(self):
135
137
136
138
def test_dnsrecord_del_all (self ):
137
139
try :
138
- self .run_command ('dnszone_add' , idnsname = u'test-example.com' )
140
+ self .run_command ('dnszone_add' , idnsname = TEST_ZONE )
139
141
except errors .NotFound :
140
142
raise nose .SkipTest ('DNS is not configured' )
141
143
try :
142
144
self .run_command ('dnsrecord_add' ,
143
- dnszoneidnsname = u'test-example.com' ,
145
+ dnszoneidnsname = TEST_ZONE ,
144
146
idnsname = u'ns' , arecord = u'1.2.3.4' , force = True )
145
147
with self .fake_stdin ('yes\n ' ):
146
- self .check_command ('dnsrecord_del test-example.com ns' ,
148
+ self .check_command ('dnsrecord_del %s ns' % TEST_ZONE ,
147
149
'dnsrecord_del' ,
148
- dnszoneidnsname = u'test-example.com' ,
150
+ dnszoneidnsname = TEST_ZONE ,
149
151
idnsname = u'ns' ,
150
152
del_all = True ,
151
153
structured = False )
152
154
with self .fake_stdin ('YeS\n ' ):
153
- self .check_command ('dnsrecord_del test-example.com ns' ,
155
+ self .check_command ('dnsrecord_del %s ns' % TEST_ZONE ,
154
156
'dnsrecord_del' ,
155
- dnszoneidnsname = u'test-example.com' ,
157
+ dnszoneidnsname = TEST_ZONE ,
156
158
idnsname = u'ns' ,
157
159
del_all = True ,
158
160
structured = False )
159
161
finally :
160
- self .run_command ('dnszone_del' , idnsname = u'test-example.com' )
162
+ self .run_command ('dnszone_del' , idnsname = TEST_ZONE )
161
163
162
164
def test_dnsrecord_del_one_by_one (self ):
163
165
try :
164
- self .run_command ('dnszone_add' , idnsname = u'test-example.com' )
166
+ self .run_command ('dnszone_add' , idnsname = TEST_ZONE )
165
167
except errors .NotFound :
166
168
raise nose .SkipTest ('DNS is not configured' )
167
169
try :
168
170
records = (u'1 1 E3B72BA346B90570EED94BE9334E34AA795CED23' ,
169
171
u'2 1 FD2693C1EFFC11A8D2BE57229212A04B45663791' )
170
172
for record in records :
171
173
self .run_command ('dnsrecord_add' ,
172
- dnszoneidnsname = u'test-example.com' , idnsname = u'ns' ,
174
+ dnszoneidnsname = TEST_ZONE , idnsname = u'ns' ,
173
175
sshfprecord = record )
174
176
with self .fake_stdin ('no\n yes\n yes\n ' ):
175
- self .check_command ('dnsrecord_del test-example.com ns' ,
177
+ self .check_command ('dnsrecord_del %s ns' % TEST_ZONE ,
176
178
'dnsrecord_del' ,
177
- dnszoneidnsname = u'test-example.com' ,
179
+ dnszoneidnsname = TEST_ZONE ,
178
180
idnsname = u'ns' ,
179
181
del_all = False ,
180
182
sshfprecord = records ,
181
183
structured = False )
182
184
finally :
183
- self .run_command ('dnszone_del' , idnsname = u'test-example.com' )
185
+ self .run_command ('dnszone_del' , idnsname = TEST_ZONE )
184
186
185
187
def test_dnsrecord_add_ask_for_missing_fields (self ):
186
188
sshfp_parts = (1 , 1 , u'E3B72BA346B90570EED94BE9334E34AA795CED23' )
187
189
188
190
with self .fake_stdin ('SSHFP\n %d\n %d\n %s' % sshfp_parts ):
189
- self .check_command ('dnsrecord-add test-example.com sshfp' ,
191
+ self .check_command ('dnsrecord-add %s sshfp' % TEST_ZONE ,
190
192
'dnsrecord_add' ,
191
- dnszoneidnsname = u'test-example.com' ,
193
+ dnszoneidnsname = TEST_ZONE ,
192
194
idnsname = u'sshfp' ,
193
195
sshfp_part_fp_type = sshfp_parts [0 ],
194
196
sshfp_part_algorithm = sshfp_parts [1 ],
@@ -201,10 +203,10 @@ def test_dnsrecord_add_ask_for_missing_fields(self):
201
203
# NOTE: when a DNS record part is passed via command line, it is not
202
204
# converted to its base type when transfered via wire
203
205
with self .fake_stdin ('%d\n %s' % (sshfp_parts [1 ], sshfp_parts [2 ])):
204
- self .check_command ('dnsrecord-add test-example.com sshfp ' \
205
- '--sshfp-algorithm=%d' % sshfp_parts [0 ],
206
+ self .check_command ('dnsrecord-add %s sshfp '
207
+ '--sshfp-algorithm=%d' % ( TEST_ZONE , sshfp_parts [0 ]) ,
206
208
'dnsrecord_add' ,
207
- dnszoneidnsname = u'test-example.com' ,
209
+ dnszoneidnsname = TEST_ZONE ,
208
210
idnsname = u'sshfp' ,
209
211
sshfp_part_fp_type = sshfp_parts [0 ],
210
212
sshfp_part_algorithm = unicode (sshfp_parts [1 ]), # passed via cmdline
@@ -215,10 +217,11 @@ def test_dnsrecord_add_ask_for_missing_fields(self):
215
217
force = False )
216
218
217
219
with self .fake_stdin (sshfp_parts [2 ]):
218
- self .check_command ('dnsrecord-add test-example.com sshfp ' \
219
- '--sshfp-algorithm=%d --sshfp-fp-type=%d' % (sshfp_parts [0 ], sshfp_parts [1 ]),
220
+ self .check_command ('dnsrecord-add %s sshfp '
221
+ '--sshfp-algorithm=%d --sshfp-fp-type=%d' % (
222
+ TEST_ZONE , sshfp_parts [0 ], sshfp_parts [1 ]),
220
223
'dnsrecord_add' ,
221
- dnszoneidnsname = u'test-example.com' ,
224
+ dnszoneidnsname = TEST_ZONE ,
222
225
idnsname = u'sshfp' ,
223
226
sshfp_part_fp_type = unicode (sshfp_parts [0 ]), # passed via cmdline
224
227
sshfp_part_algorithm = unicode (sshfp_parts [1 ]), # passed via cmdline
@@ -231,26 +234,26 @@ def test_dnsrecord_add_ask_for_missing_fields(self):
231
234
def test_dnsrecord_del_comma (self ):
232
235
try :
233
236
self .run_command (
234
- 'dnszone_add' , idnsname = u'test-example.com' )
237
+ 'dnszone_add' , idnsname = TEST_ZONE )
235
238
except errors .NotFound :
236
239
raise nose .SkipTest ('DNS is not configured' )
237
240
try :
238
241
self .run_command (
239
242
'dnsrecord_add' ,
240
- dnszoneidnsname = u'test-example.com' ,
243
+ dnszoneidnsname = TEST_ZONE ,
241
244
idnsname = u'test' ,
242
245
txtrecord = u'"A pretty little problem," said Holmes.' )
243
246
with self .fake_stdin ('no\n yes\n ' ):
244
247
self .check_command (
245
- 'dnsrecord_del test-example.com test' ,
248
+ 'dnsrecord_del %s test' % TEST_ZONE ,
246
249
'dnsrecord_del' ,
247
- dnszoneidnsname = u'test-example.com' ,
250
+ dnszoneidnsname = TEST_ZONE ,
248
251
idnsname = u'test' ,
249
252
del_all = False ,
250
253
txtrecord = [u'"A pretty little problem," said Holmes.' ],
251
254
structured = False )
252
255
finally :
253
- self .run_command ('dnszone_del' , idnsname = u'test-example.com' )
256
+ self .run_command ('dnszone_del' , idnsname = TEST_ZONE )
254
257
255
258
def test_idrange_add (self ):
256
259
"""
0 commit comments