@@ -1032,6 +1032,26 @@ def testPragma(self):
1032
1032
expected = 'Error: Internal error: pragma can not handle values of type: float'
1033
1033
self .assertIn (expected , out )
1034
1034
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
+
1035
1055
# -----
1036
1056
AdminTool .my_input = orig_input
1037
1057
@@ -1479,6 +1499,7 @@ def testSpecification(self):
1479
1499
'timezone: <roundup.hyperdb.String>' ,
1480
1500
'password: <roundup.hyperdb.Password>' ,
1481
1501
]
1502
+
1482
1503
1483
1504
with captured_output () as (out , err ):
1484
1505
sys .argv = ['main' , '-i' , self .dirname , 'specification' , 'user' ]
@@ -1488,6 +1509,28 @@ def testSpecification(self):
1488
1509
print (outlist )
1489
1510
self .assertEqual (sorted (outlist ), sorted (spec ))
1490
1511
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
+
1491
1534
def testRetireRestore (self ):
1492
1535
''' Note the tests will fail if you run this under pdb.
1493
1536
the context managers capture the pdb prompts and this screws
0 commit comments