@@ -1032,6 +1032,26 @@ def testPragma(self):
10321032 expected = 'Error: Internal error: pragma can not handle values of type: float'
10331033 self .assertIn (expected , out )
10341034
1035+
1036+ # -----
1037+ inputs = iter (["pragma display_protected=yes" ,
1038+ "display user1" ,
1039+ "quit" ])
1040+ AdminTool .my_input = lambda _self , _prompt : next (inputs )
1041+
1042+ self .install_init ()
1043+ self .admin = AdminTool ()
1044+ sys .argv = ['main' , '-i' , self .dirname ]
1045+
1046+ with captured_output () as (out , err ):
1047+ ret = self .admin .main ()
1048+
1049+ out = out .getvalue ().strip ()
1050+
1051+ print (ret )
1052+ expected = '\n *creation: '
1053+ self .assertIn (expected , out )
1054+
10351055 # -----
10361056 AdminTool .my_input = orig_input
10371057
@@ -1479,6 +1499,7 @@ def testSpecification(self):
14791499 'timezone: <roundup.hyperdb.String>' ,
14801500 'password: <roundup.hyperdb.Password>' ,
14811501 ]
1502+
14821503
14831504 with captured_output () as (out , err ):
14841505 sys .argv = ['main' , '-i' , self .dirname , 'specification' , 'user' ]
@@ -1488,6 +1509,28 @@ def testSpecification(self):
14881509 print (outlist )
14891510 self .assertEqual (sorted (outlist ), sorted (spec ))
14901511
1512+ # -----
1513+ inputs = iter (["pragma display_protected=1" , "spec user" , "quit" ])
1514+ AdminTool .my_input = lambda _self , _prompt : next (inputs )
1515+
1516+ self .install_init ()
1517+ self .admin = AdminTool ()
1518+ sys .argv = ['main' , '-i' , self .dirname ]
1519+
1520+ with captured_output () as (out , err ):
1521+ ret = self .admin .main ()
1522+
1523+ # strip greeting and help text lines
1524+ outlist = out .getvalue ().strip ().split ('\n ' )[2 :]
1525+
1526+ protected = [ 'id: <roundup.hyperdb.String>' ,
1527+ 'creation: <roundup.hyperdb.Date>' ,
1528+ 'activity: <roundup.hyperdb.Date>' ,
1529+ 'creator: <roundup.hyperdb.Link to "user">' ,
1530+ 'actor: <roundup.hyperdb.Link to "user">' ]
1531+ print (outlist )
1532+ self .assertEqual (sorted (outlist ), sorted (spec + protected ))
1533+
14911534 def testRetireRestore (self ):
14921535 ''' Note the tests will fail if you run this under pdb.
14931536 the context managers capture the pdb prompts and this screws
0 commit comments