Skip to content

Commit 115d735

Browse files
committed
user list with -a
1 parent 39572fe commit 115d735

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lfss/cli/user.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def parse_bool(s):
4343
sp_list = sp.add_parser('list', help="List specified users, or detailed info with -l")
4444
sp_list.add_argument("username", nargs='*', type=str, default=None)
4545
sp_list.add_argument("-l", "--long", action="store_true", help="Show detailed information, including credential and peer users")
46-
sp_list.add_argument("--hidden", action="store_true", help="Include hidden users (virtual users) in the listing")
46+
sp_list.add_argument("-a", '--all', action="store_true", dest="show_all", help="Show all users, include hidden users (virtual users) in the listing")
4747

4848
sp_peer = sp.add_parser('set-peer', help="Set peer user relationship")
4949
sp_peer.add_argument('src_username', type=str)
@@ -107,7 +107,7 @@ async def get_uconn():
107107
async with get_uconn() as uconn:
108108
term_width = os.get_terminal_size().columns
109109
async def __iter_users():
110-
if args.hidden:
110+
if args.show_all:
111111
async for user in uconn.iter_all(): yield user
112112
async for user in uconn.iter_hidden(): yield user
113113
else:

test/cases/test_14_virtual_user.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ def test_init_user_creation(server):
2727
v1_token = v1.credential
2828
v1_name = v1.username
2929

30+
def test_u1_create(server):
31+
u1 = get_conn('u1')
32+
with pytest.raises(Exception, match="403"):
33+
u1.add_virtual_user(tag="baduser", peers={AccessLevel.READ: ['u0']})
34+
3035
def test_v1_put(server):
3136
v1 = get_conn_bytoken(v1_token)
3237

0 commit comments

Comments
 (0)