update test file and fixing set_user password bug
This commit is contained in:
parent
bd6554f88d
commit
619aaf1f43
10
test.py
10
test.py
@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
from zk import const
|
||||
sys.path.append("zk")
|
||||
|
||||
import zk
|
||||
@ -11,9 +12,12 @@ if conn.get('status'):
|
||||
print conn
|
||||
print zk.disable_device()
|
||||
print 'Firmware Version: : {}'.format(zk.get_firmware_version())
|
||||
# Load test create 1000 users
|
||||
for i in range(1, 1000+1):
|
||||
zk.set_user(uid=i, user_id='{}'.format(i), name='user #{}'.format(i), password='123456', privilege=14)
|
||||
# Load test create 2000 users
|
||||
for i in range(1, 2000+1):
|
||||
privilege = const.USER_DEFAULT
|
||||
if i == 1:
|
||||
privilege = const.USER_ADMIN
|
||||
print zk.set_user(uid=i, name='user #{}'.format(i), privilege=privilege, password='123456', group_id='', user_id='{}'.format(i))
|
||||
# print 'Restarting device'
|
||||
# print zk.restart()
|
||||
# print 'Turning off device'
|
||||
|
@ -210,7 +210,7 @@ class ZK(object):
|
||||
privilege = const.USER_DEFAULT
|
||||
privilege = chr(privilege)
|
||||
|
||||
command_string = pack('2sc6s30sc7sx24s', uid, privilege, password, name, chr(0), group_id, user_id)
|
||||
command_string = pack('2sc8s28sc7sx24s', uid, privilege, password, name, chr(0), group_id, user_id)
|
||||
cmd_response = self.__send_command(command=command, command_string=command_string, response_size=1024)
|
||||
cmd_response['data'] = ''
|
||||
if cmd_response.get('status'):
|
||||
|
Loading…
Reference in New Issue
Block a user