@@ -275,6 +275,51 @@ def testFind(self):
275
275
# so eval to real list so Equal can do a list compare
276
276
self .assertEqual (sorted (eval (out )), ['1' , '2' ])
277
277
278
+ def testGenconfigUpdate (self ):
279
+ ''' Note the tests will fail if you run this under pdb.
280
+ the context managers capture the pdb prompts and this screws
281
+ up the stdout strings with (pdb) prefixed to the line.
282
+ '''
283
+ import sys
284
+
285
+ self .admin = AdminTool ()
286
+ self .install_init ()
287
+
288
+ with captured_output () as (out , err ):
289
+ sys .argv = ['main' , '-i' , '_test_admin' , 'genconfig' ]
290
+ ret = self .admin .main ()
291
+
292
+ out = out .getvalue ().strip ()
293
+ print (out )
294
+ expected = "Not enough arguments supplied"
295
+ self .assertTrue (expected in out )
296
+
297
+ # Reopen the db closed by previous call
298
+ self .admin = AdminTool ()
299
+
300
+ with captured_output () as (out , err ):
301
+ sys .argv = ['main' , '-i' , '_test_admin' , 'genconfig' , "foo" ]
302
+ ret = self .admin .main ()
303
+
304
+ out = out .getvalue ().strip ()
305
+ print (out )
306
+ # FIXME get better successful test later.
307
+ expected = ""
308
+ self .assertTrue (expected in out )
309
+
310
+ # Reopen the db closed by previous call
311
+ self .admin = AdminTool ()
312
+
313
+ with captured_output () as (out , err ):
314
+ sys .argv = ['main' , '-i' , '_test_admin' , 'update' , "foo2" ]
315
+ ret = self .admin .main ()
316
+
317
+ out = out .getvalue ().strip ()
318
+ print (out )
319
+ # FIXME get better successful test later.
320
+ expected = ""
321
+ self .assertTrue (expected in out )
322
+
278
323
def testCliParse (self ):
279
324
''' Note the tests will fail if you run this under pdb.
280
325
the context managers capture the pdb prompts and this screws
@@ -333,7 +378,6 @@ def testCliParse(self):
333
378
'("help commands" for a list)' )
334
379
self .assertEqual (expected , out )
335
380
336
-
337
381
# Reopen the db closed by previous call
338
382
self .admin = AdminTool ()
339
383
# test for keyword=value check
0 commit comments