@@ -118,27 +118,24 @@ def teardown():
118
118
119
119
# test enabled=False
120
120
assert await r .acl_setuser (username , enabled = False , reset = True )
121
- assert await r .acl_getuser (username ) == {
122
- "categories" : ["-@all" ],
123
- "commands" : [],
124
- "channels" : [b"*" ],
125
- "enabled" : False ,
126
- "flags" : ["off" , "allchannels" , "sanitize-payload" ],
127
- "keys" : [],
128
- "passwords" : [],
129
- }
121
+ acl = await r .acl_getuser (username )
122
+ assert acl ["categories" ] == ["-@all" ]
123
+ assert acl ["commands" ] == []
124
+ assert acl ["keys" ] == []
125
+ assert acl ["passwords" ] == []
126
+ assert "off" in acl ["flags" ]
127
+ assert acl ["enabled" ] is False
130
128
131
129
# test nopass=True
132
130
assert await r .acl_setuser (username , enabled = True , reset = True , nopass = True )
133
- assert await r .acl_getuser (username ) == {
134
- "categories" : ["-@all" ],
135
- "commands" : [],
136
- "channels" : [b"*" ],
137
- "enabled" : True ,
138
- "flags" : ["on" , "allchannels" , "nopass" , "sanitize-payload" ],
139
- "keys" : [],
140
- "passwords" : [],
141
- }
131
+ acl = await r .acl_getuser (username )
132
+ assert acl ["categories" ] == ["-@all" ]
133
+ assert acl ["commands" ] == []
134
+ assert acl ["keys" ] == []
135
+ assert acl ["passwords" ] == []
136
+ assert "on" in acl ["flags" ]
137
+ assert "nopass" in acl ["flags" ]
138
+ assert acl ["enabled" ] is True
142
139
143
140
# test all args
144
141
assert await r .acl_setuser (
@@ -155,7 +152,7 @@ def teardown():
155
152
assert set (acl ["commands" ]) == {"+get" , "+mget" , "-hset" }
156
153
assert acl ["enabled" ] is True
157
154
assert acl ["channels" ] == [b"*" ]
158
- assert acl [ "flags" ] == [ "on" , "allchannels" , "sanitize-payload " ]
155
+ assert "on" in acl [ "flags " ]
159
156
assert set (acl ["keys" ]) == {b"cache:*" , b"objects:*" }
160
157
assert len (acl ["passwords" ]) == 2
161
158
@@ -182,7 +179,7 @@ def teardown():
182
179
assert set (acl ["commands" ]) == {"+get" , "+mget" }
183
180
assert acl ["enabled" ] is True
184
181
assert acl ["channels" ] == [b"*" ]
185
- assert acl [ "flags" ] == [ "on" , "allchannels" , "sanitize-payload " ]
182
+ assert "on" in acl [ "flags " ]
186
183
assert set (acl ["keys" ]) == {b"cache:*" , b"objects:*" }
187
184
assert len (acl ["passwords" ]) == 2
188
185
@@ -233,7 +230,7 @@ def teardown():
233
230
234
231
assert await r .acl_setuser (username , enabled = False , reset = True )
235
232
users = await r .acl_list ()
236
- assert "user %s off sanitize-payload &* -@all" % username in users
233
+ assert len ( users ) == 2
237
234
238
235
@skip_if_server_version_lt (REDIS_6_VERSION )
239
236
async def test_acl_log (self , r : aioredis .Redis , request , event_loop , create_redis ):
0 commit comments