diff --git a/test/class/user.class.php b/test/class/user.class.php old mode 100644 new mode 100755 index c74010d5b8..dc5da2b4bf --- a/test/class/user.class.php +++ b/test/class/user.class.php @@ -520,14 +520,8 @@ class userTest { $myObjects = $this->objectModel->getObjects($account, $type, $status, $orderBy); - if(dao::isError()) - { - return dao::getError(); - } - else - { - return $myObjects; - } + if(dao::isError()) return dao::getError(); + return $myObjects; } /** @@ -542,14 +536,8 @@ class userTest { $contacts = $this->objectModel->getContactLists($account, $params); - if(dao::isError()) - { - return dao::getError(); - } - else - { - return $contacts; - } + if(dao::isError()) return dao::getError(); + return $contacts; } /** @@ -597,7 +585,7 @@ class userTest */ public function getContactUserPairsTest($accountList) { - return $this->objectModel->getContactListByID($listID); + return $this->objectModel->getContactUserPairs($accountList); } /** @@ -612,14 +600,8 @@ class userTest { $listID = $this->objectModel->createContactList($listName, $userList); - if(dao::isError()) - { - return dao::getError(); - } - else - { - return $listID; - } + if(dao::isError()) return dao::getError(); + return $this->objectModel->getContactListByID($listID); } /** @@ -635,13 +617,97 @@ class userTest { $this->objectModel->updateContactList($listID, $listName, $userList); - if(dao::isError()) - { - return dao::getError(); - } - else - { - return $this->objectModel->getContactListByID($listID); - } + if(dao::isError()) return dao::getError(); + return $this->objectModel->getContactListByID($listID); + } + + /** + * Test delete a contact list. + * + * @param int $listID + * @access public + * @return void + */ + public function deleteContactListTest($listID) + { + $this->objectModel->deleteContactList($listID); + + if(dao::isError()) return dao::getError(); + return $this->objectModel->getContactListByID($listID); + } + + /** + * Test delete a contact list. + * + * @param object $user + * @access public + * @return void + */ + public function getDataInJSONTest($user) + { + $user = $this->objectModel->getDataInJSON($user); + + if(dao::isError()) return dao::getError(); + return $user; + } + + /** + * Test get weak users. + * + * @access public + * @return void + */ + public function getWeakUsersTest() + { + $users = $this->objectModel->getWeakUsers(); + + if(dao::isError()) return dao::getError(); + return $users; + } + + /** + * Test compute password strength. + * + * @access public + * @return void + */ + public function computePasswordStrengthTest($password) + { + $strength = $this->objectModel->computePasswordStrength($password); + + if(dao::isError()) return dao::getError(); + return $strength; + } + + /** + * Test compute user view. + * + * @param string $account + * @param bool $force + * @access public + * @return void + */ + public function computeUserViewTest($account, $force = false) + { + $userview = $this->objectModel->computeUserView($account, $force); + + if(dao::isError()) return dao::getError(); + return $userview; + } + + /** + * Test get product members. + * + * @param string $account + * @param bool $force + * @access public + * @return void + */ + public function getProductMembersTest($allProducts) + { + $members = $this->objectModel->getProductMembers($allProducts); + + if(dao::isError()) return dao::getError(); + return $members; } } diff --git a/test/model/user/authorize.php b/test/model/user/authorize.php old mode 100644 new mode 100755 index 943b4f1a56..dd2254e3ca --- a/test/model/user/authorize.php +++ b/test/model/user/authorize.php @@ -10,6 +10,10 @@ title=userModel->authorizeTest(); cid=1 pid=1 +获取用户的权限,返回权限列表 >> 1 +获取用户的权限,返回权限列表 >> 1 +获取空用户名的权限,返回空 >> 0 + */ $user = new userTest(); @@ -18,4 +22,4 @@ $rights = $user->authorizeTest('test2'); r($rights['rights']) && p('action:comment') && e('1'); //获取用户的权限,返回权限列表 r($rights['rights']) && p('testtask:activate') && e('1'); //获取用户的权限,返回权限列表 r($user->authorizeTest('sadf!!@#a')) && p('projects') && e(''); //获取不存在的用户的权限,返回空 -r($user->authorizeTest('')) && p('') && e('0'); //获取空用户名的权限,返回空 +r($user->authorizeTest('')) && p('') && e('0'); //获取空用户名的权限,返回空 \ No newline at end of file diff --git a/test/model/user/batchcreate.php b/test/model/user/batchcreate.php old mode 100644 new mode 100755 index 6a11f8e31d..2348dd02e7 --- a/test/model/user/batchcreate.php +++ b/test/model/user/batchcreate.php @@ -10,14 +10,8 @@ title=userModel->batchCreateTest(); cid=1 pid=1 -密码较弱的情况 >> 您的密码强度小于系统设定。 -Visions为空的情况 >> 『版本类型』不能为空。 -用户名为空的情况 >> 『用户名』不能为空。 -用户名特殊的情况 >> 『用户名』只能是字母、数字或下划线的组合三位以上。 -两次密码不相同的情况 >> 两次密码应该相同。 -插入重复的用户名,返回报错信息 >> 『用户名』已经有『admin』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。 -正常插入用户,返回新插入的ID、真实姓名 >> 1001,新的测试用户 -正常插入用户,返回新插入的真实姓名 >> 新的测试用户 +获取插入的第一个用户的account >> newtestuser1 +获取插入的最后一个用户的realname >> 新测试用户3 */ @@ -33,4 +27,4 @@ $normalUser['password'] = array(1 => 'e10adc3949ba59abbe56e057f20f883e', 2 => 'e r($user->batchCreateUserTest($normalUser)) && p('0:account') && e('newtestuser1'); //获取插入的第一个用户的account r($user->batchCreateUserTest($normalUser)) && p('2:realname') && e('新测试用户3'); //获取插入的最后一个用户的realname -system("./ztest init"); +system("./ztest init"); \ No newline at end of file diff --git a/test/model/user/batchedit.php b/test/model/user/batchedit.php old mode 100644 new mode 100755 index dc509eaf48..88c35c9071 --- a/test/model/user/batchedit.php +++ b/test/model/user/batchedit.php @@ -10,14 +10,8 @@ title=userModel->batchEditTest(); cid=1 pid=1 -密码较弱的情况 >> 您的密码强度小于系统设定。 -Visions为空的情况 >> 『版本类型』不能为空。 -用户名为空的情况 >> 『用户名』不能为空。 -用户名特殊的情况 >> 『用户名』只能是字母、数字或下划线的组合三位以上。 -两次密码不相同的情况 >> 两次密码应该相同。 -插入重复的用户名,返回报错信息 >> 『用户名』已经有『admin』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。 -正常插入用户,返回新插入的ID、真实姓名 >> 1001,新的测试用户 -正常插入用户,返回新插入的真实姓名 >> 新的测试用户 +获取编辑后的第一个用户的account >> newtestuser1 +获取编辑的最后一个用户的真实姓名 >> 新测试用户3 */ @@ -33,4 +27,4 @@ $normalUser['password'] = array(998 => 'e10adc3949ba59abbe56e057f20f883e', 999 = r($user->batchEditUserTest($normalUser)) && p('998:account') && e('newtestuser1'); //获取编辑后的第一个用户的account r($user->batchEditUserTest($normalUser)) && p('1000:realname') && e('新测试用户3'); //获取编辑的最后一个用户的真实姓名 -system("./ztest init"); +system("./ztest init"); \ No newline at end of file diff --git a/test/model/user/checkpassword.php b/test/model/user/checkpassword.php old mode 100644 new mode 100755 index 63ae484b00..9143d3e1ce --- a/test/model/user/checkpassword.php +++ b/test/model/user/checkpassword.php @@ -10,14 +10,10 @@ title=userModel->checkPasswordTest(); cid=1 pid=1 -密码较弱的情况 >> 您的密码强度小于系统设定。 -Visions为空的情况 >> 『版本类型』不能为空。 -用户名为空的情况 >> 『用户名』不能为空。 -用户名特殊的情况 >> 『用户名』只能是字母、数字或下划线的组合三位以上。 +正常的用户密码 >> 无报错 两次密码不相同的情况 >> 两次密码应该相同。 -插入重复的用户名,返回报错信息 >> 『用户名』已经有『admin』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。 -正常插入用户,返回新插入的ID、真实姓名 >> 1001,新的测试用户 -正常插入用户,返回新插入的真实姓名 >> 新的测试用户 +密码强度小于系统设定 >> 您的密码强度小于系统设定。 +使用常见简单密码,给出错误提示 >> 密码不能使用【123456,password,12345,12345678,qwerty,123456789,1234,1234567,abc123,111111,123123】这些常用弱口令。 */ @@ -41,4 +37,4 @@ r($user->checkPasswordTest($normalUser)) && p('password') && e('无 r($user->checkPasswordTest($differentPassword)) && p('password:0') && e('两次密码应该相同。'); //两次密码不相同的情况 r($user->checkPasswordTest($weakPassword)) && p('password1:0') && e('您的密码强度小于系统设定。'); //密码强度小于系统设定 r($user->checkPasswordTest($simplePassword)) && p('password1:0') && e('密码不能使用【123456,password,12345,12345678,qwerty,123456789,1234,1234567,abc123,111111,123123】这些常用弱口令。'); //使用常见简单密码,给出错误提示 -system("./ztest init"); +system("./ztest init"); \ No newline at end of file diff --git a/test/model/user/computepasswordstrengthtest.php b/test/model/user/computepasswordstrengthtest.php new file mode 100755 index 0000000000..39381672e6 --- /dev/null +++ b/test/model/user/computepasswordstrengthtest.php @@ -0,0 +1,27 @@ +#!/usr/bin/env php +computePasswordStrengthTest(); +cid=1 +pid=1 + +获取空密码的强度 >> 0 +获取[123456]密码的强度 >> 0 +获取[qaz123]密码的强度 >> 0 +获取[qaz67911334]密码的强度 >> 1 +获取[ZENFBQfy3xpRarDwG3lN]密码的强度 >> 2 + +*/ + +$user = new userTest(); + +r($user->computePasswordStrengthTest('')) && p() && e('0'); //获取空密码的强度 +r($user->computePasswordStrengthTest('123456')) && p() && e('0'); //获取[123456]密码的强度 +r($user->computePasswordStrengthTest('qaz123')) && p() && e('0'); //获取[qaz123]密码的强度 +r($user->computePasswordStrengthTest('qaz67911334')) && p() && e('1'); //获取[qaz67911334]密码的强度 +r($user->computePasswordStrengthTest('ZENFBQfy3xpRarDwG3lN')) && p() && e('2'); //获取[ZENFBQfy3xpRarDwG3lN]密码的强度 \ No newline at end of file diff --git a/test/model/user/computeuserview.php b/test/model/user/computeuserview.php new file mode 100755 index 0000000000..728e2c77ae --- /dev/null +++ b/test/model/user/computeuserview.php @@ -0,0 +1,31 @@ +#!/usr/bin/env php +computeUserViewTest(); +cid=1 +pid=1 + +获取admin账户可见的前两个项目ID >> ,1,3, +获取admin账户可见的前两个产品ID >> ,1,2, +获取user10账户可见的产品ID >> 99 +用户名传null,则获取当前登录账户的views >> admin + +*/ + +$user = new userTest(); + +$adminViews = $user->computeUserViewTest('admin', true); +$adminProjects = substr($adminViews->projects, 0, 5); +$adminProducts = substr($adminViews->products, 0, 5); + +r($adminProjects) && p() && e(',1,3,'); //获取admin账户可见的前两个项目ID +r($adminProducts) && p() && e(',1,2,'); //获取admin账户可见的前两个产品ID +r($user->computeUserViewTest('user10')) && p('products') && e('99'); //获取user10账户可见的产品ID +r($user->computeUserViewTest('test2')) && p('projects') && e(''); //获取test2账户可见的项目ID +r($user->computeUserViewTest(null)) && p('account') && e('admin'); //用户名传null,则获取当前登录账户的views +system("./ztest init"); \ No newline at end of file diff --git a/test/model/user/create.php b/test/model/user/create.php old mode 100644 new mode 100755 index 1a8c0d5779..50ca8882e7 --- a/test/model/user/create.php +++ b/test/model/user/create.php @@ -57,4 +57,4 @@ r($user->createUserTest($differentPassword)) && p('password:0') && e('两次密 r($user->createUserTest($existUser)) && p('account:0') && e('『用户名』已经有『admin』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。'); //插入重复的用户名,返回报错信息 r($user->createUserTest($normalUser)) && p('id,realname') && e('1001,新的测试用户'); //正常插入用户,返回新插入的ID、真实姓名 r($user->createUserTest($normalUser)) && p('realname') && e('新的测试用户'); //正常插入用户,返回新插入的真实姓名 -system("./ztest init"); +system("./ztest init"); \ No newline at end of file diff --git a/test/model/user/createcontactlist.php b/test/model/user/createcontactlist.php new file mode 100644 index 0000000000..8af810363a --- /dev/null +++ b/test/model/user/createcontactlist.php @@ -0,0 +1,24 @@ +#!/usr/bin/env php +createContactListTest(); +cid=1 +pid=1 + +插入一条联系人列表,获取插入的联系人列表名称 >> 新的列表名称1 +插入一条联系人列表,获取插入的联系人列表名称 >> 新的列表名称2 + +*/ +$user = new userTest(); +$userList = array('admin,test2,user29,assfjg'); + +r($user->createContactListTest('新的列表名称1', $userList)) && p('listName') && e('新的列表名称1'); //插入一条联系人列表,获取插入的联系人列表名称 +r($user->createContactListTest('新的列表名称2', $userList)) && p('listName') && e('新的列表名称2'); //插入一条联系人列表,获取插入的联系人列表名称 +r($user->createContactListTest('新的列表名称3', array())) && p('userList') && e(''); //插入一条联系人列表,获取插入的联系人列表 + +system("./ztest init"); \ No newline at end of file diff --git a/test/model/user/deletecontactlist.php b/test/model/user/deletecontactlist.php new file mode 100644 index 0000000000..d7afb2c1e5 --- /dev/null +++ b/test/model/user/deletecontactlist.php @@ -0,0 +1,26 @@ +#!/usr/bin/env php +deleteContactListTest(); +cid=1 +pid=1 + +删除ID为1的联系人列表 >> 0 +删除ID为2的联系人列表 >> 0 +删除ID为null的联系人列表 >> 0 +删除ID为1000的联系人列表 >> 0 + +*/ +$user = new userTest(); + +r($user->deleteContactListTest(1)) && p('listName') && e('0'); //删除ID为1的联系人列表 +r($user->deleteContactListTest(2)) && p('listName') && e('0'); //删除ID为2的联系人列表 +r($user->deleteContactListTest(null)) && p('userLsit') && e('0'); //删除ID为null的联系人列表 +r($user->deleteContactListTest(1000)) && p('userList') && e('0'); //删除ID为1000的联系人列表 + +system("./ztest init"); \ No newline at end of file diff --git a/test/model/user/getavatarpairs.php b/test/model/user/getavatarpairs.php old mode 100644 new mode 100755 diff --git a/test/model/user/getbyquery.php b/test/model/user/getbyquery.php old mode 100644 new mode 100755 diff --git a/test/model/user/getcommiters.php b/test/model/user/getcommiters.php old mode 100644 new mode 100755 diff --git a/test/model/user/getcontactlistbyid.php b/test/model/user/getcontactlistbyid.php old mode 100644 new mode 100755 index 90e8527170..bdfbc68554 --- a/test/model/user/getcontactlistbyid.php +++ b/test/model/user/getcontactlistbyid.php @@ -10,12 +10,18 @@ title=测试 userModel::getContactListByIDTest(); cid=1 pid=1 +获取ID为1的联系人列表名称 >> 联系人列表1 +获取ID为60的联系人列表创建者 >> admin +获取ID为1000的联系人列表,返回空 >> 0 +获取ID为false的联系人列表,返回空 >> 0 +获取ID为null的联系人列表,返回空 >> 0 + */ $user = new userTest(); -r($user->getContactListByIDTest(1)) && p() && e('0'); // -r($user->getContactListByIDTest(2)) && p() && e('0'); // -r($user->getContactListByIDTest(1000)) && p() && e('0'); // -r($user->getContactListByIDTest(false)) && p() && e('0'); // -r($user->getContactListByIDTest(null)) && p() && e('0'); // +r($user->getContactListByIDTest(1)) && p('listName') && e('联系人列表1'); //获取ID为1的联系人列表名称 +r($user->getContactListByIDTest(60)) && p('account') && e('admin'); //获取ID为60的联系人列表创建者 +r($user->getContactListByIDTest(1000)) && p() && e('0'); //获取ID为1000的联系人列表,返回空 +r($user->getContactListByIDTest(false)) && p() && e('0'); //获取ID为false的联系人列表,返回空 +r($user->getContactListByIDTest(null)) && p() && e('0'); //获取ID为null的联系人列表,返回空 \ No newline at end of file diff --git a/test/model/user/getcontactlists.php b/test/model/user/getcontactlists.php old mode 100644 new mode 100755 index cca7a64b5f..e0566b2eb5 --- a/test/model/user/getcontactlists.php +++ b/test/model/user/getcontactlists.php @@ -10,6 +10,8 @@ title=测试 userModel::getContactListsTest(); cid=1 pid=1 +获取admin的联系人列表 >> 0 + */ $user = new userTest(); $adminContactList1 = $user->getContactListsTest('admin', 'withempty|withnote'); @@ -17,4 +19,4 @@ $adminContactList2 = $user->getContactListsTest('admin', ''); $test2ContactList = $user->getContactListsTest('test2'); $emptyContactList = $user->getContactListsTest('', ''); -r($adminContactList) && p() && e('0'); // 获取admin的联系人列表 +r($adminContactList) && p() && e('0'); // 获取admin的联系人列表 \ No newline at end of file diff --git a/test/model/user/getcontactuserpairs.php b/test/model/user/getcontactuserpairs.php old mode 100644 new mode 100755 index eb3db10ad3..8440daeb33 --- a/test/model/user/getcontactuserpairs.php +++ b/test/model/user/getcontactuserpairs.php @@ -10,8 +10,14 @@ title=userModel->getContactUserPairsTest(); cid=1 pid=1 +根据传入的accountList获取admin真实姓名 >> admin +根据传入的accountList获取test2真实姓名 >> 测试2 + */ $user = new userTest(); -$accountList = array('admin', 'test2'); +$accountList = array('admin', 'test2', 'asdffg', null); -r($user->getContactUserPairsTest($accountList)) && p('') && e(''); // +r($user->getContactUserPairsTest($accountList)) && p('admin') && e('admin'); //根据传入的accountList获取admin真实姓名 +r($user->getContactUserPairsTest($accountList)) && p('test2') && e('测试2'); //根据传入的accountList获取test2真实姓名 +r($user->getContactUserPairsTest($accountList)) && p('asdffg') && e(''); //根据传入的accountList获取asdffg真实姓名 +r($user->getContactUserPairsTest($accountList)) && p('null') && e(''); //根据传入的accountList获取null真实姓名 \ No newline at end of file diff --git a/test/model/user/getdatainjson.php b/test/model/user/getdatainjson.php new file mode 100644 index 0000000000..117cf50b01 --- /dev/null +++ b/test/model/user/getdatainjson.php @@ -0,0 +1,29 @@ +#!/usr/bin/env php +getDataInJSON(); +cid=1 +pid=1 + +传入admin用户信息,返回公司信息 >> 易软天创网络科技有限公司 +传入admin用户信息,返回用户名信息 >> admin +传入null用户信息,返回公司信息 >> 易软天创网络科技有限公司 + +*/ +$user = new userTest(); + +$admin = new stdclass(); +$admin->id = 1; +$admin->account = 'admin'; +$admin->password = '123456'; +$admin->deleted = '1'; + +r($user->getDataInJSONTest($admin)) && p('user:company') && e('易软天创网络科技有限公司'); //传入admin用户信息,返回公司信息 +r($user->getDataInJSONTest($admin)) && p('user:account') && e('admin'); //传入admin用户信息,返回用户名信息 +r($user->getDataInJSONTest($admin)) && p('user:password') && e(''); //传入admin用户信息,返回密码信息 +r($user->getDataInJSONTest(null)) && p('user:company') && e('易软天创网络科技有限公司'); //传入null用户信息,返回公司信息 \ No newline at end of file diff --git a/test/model/user/getgroups.php b/test/model/user/getgroups.php old mode 100644 new mode 100755 index e8d8ad402d..513c8eb460 --- a/test/model/user/getgroups.php +++ b/test/model/user/getgroups.php @@ -10,9 +10,13 @@ title=测试 userModel::getGroupsTest(); cid=1 pid=1 +获取admin所在的分组,为空 >> 0 +通过test2所在的分组数量,1个 >> 1 +传空用户名,返回空 >> 0 + */ $user = new userTest(); r($user->getGroupsTest('admin')) && p() && e('0'); // 获取admin所在的分组,为空 r(count($user->getGroupsTest('test2'))) && p() && e('1'); // 通过test2所在的分组数量,1个 -r($user->getGroupsTest('')) && p() && e('0'); // 传空用户名,返回空 +r($user->getGroupsTest('')) && p() && e('0'); // 传空用户名,返回空 \ No newline at end of file diff --git a/test/model/user/getgroupsbyvisions.php b/test/model/user/getgroupsbyvisions.php old mode 100644 new mode 100755 index c16e6e3d27..cb7998f81f --- a/test/model/user/getgroupsbyvisions.php +++ b/test/model/user/getgroupsbyvisions.php @@ -10,10 +10,15 @@ title=测试 userModel::getGroupsByVisionsTest(); cid=1 pid=1 +获取系统中所有研发界面分组的数量 >> 14 +获取系统中所有迅捷界面分组的数量 >> 3 +传空Visions,返回空数组 >> 0 +获取系统中所有用户分组的数量 >> 17 + */ $user = new userTest(); r(count($user->getGroupsByVisionsTest(array('rnd')))) && p() && e('14'); // 获取系统中所有研发界面分组的数量 r(count($user->getGroupsByVisionsTest(array('lite')))) && p() && e('3'); // 获取系统中所有迅捷界面分组的数量 r($user->getGroupsByVisionsTest(array())) && p() && e('0'); // 传空Visions,返回空数组 -r(count($user->getGroupsByVisionsTest(array('rnd','lite')))) && p() && e('17'); // 获取系统中所有用户分组的数量 +r(count($user->getGroupsByVisionsTest(array('rnd','lite')))) && p() && e('17'); // 获取系统中所有用户分组的数量 \ No newline at end of file diff --git a/test/model/user/getlist.php b/test/model/user/getlist.php old mode 100644 new mode 100755 diff --git a/test/model/user/getlistbyaccount.php b/test/model/user/getlistbyaccount.php old mode 100644 new mode 100755 index df5cec6540..d5c4294612 --- a/test/model/user/getlistbyaccount.php +++ b/test/model/user/getlistbyaccount.php @@ -10,6 +10,10 @@ title=测试 userModel::getListByAccount(); cid=1 pid=1 +获取admin的联系人列表 >> 0 +获取admin的联系人列表 >> 0 +获取admin的联系人列表 >> 0 + */ $user = new userTest(); $adminContactList = $user->getListByAccountTest('admin'); @@ -18,4 +22,4 @@ $emptyContactList = $user->getListByAccountTest(''); r($adminContactList) && p() && e('0'); // 获取admin的联系人列表 r($test2ContactList) && p() && e('0'); // 获取admin的联系人列表 -r($emptyContactList) && p() && e('0'); // 获取admin的联系人列表 +r($emptyContactList) && p() && e('0'); // 获取admin的联系人列表 \ No newline at end of file diff --git a/test/model/user/getlistbyaccounts.php b/test/model/user/getlistbyaccounts.php old mode 100644 new mode 100755 diff --git a/test/model/user/getobjects.php b/test/model/user/getobjects.php old mode 100644 new mode 100755 index d01c0f9344..d814c4c8ec --- a/test/model/user/getobjects.php +++ b/test/model/user/getobjects.php @@ -10,6 +10,13 @@ title=测试 userModel::getObjectsTest(); cid=1 pid=1 +获取admin的所属项目列表,取ID为11的项目名字 >> 项目1 +获取admin的所属项目列表,取ID为11的项目类型 >> project +获取admin的所属执行列表,取ID为120的项目名字 >> 迭代20 +获取admin的已完成的所属项目列表,返回空 >> 0 +获取test2用户的所属项目列表,返回空 >> 0 +传入一个空用户名字段,返回空 >> 0 + */ $user = new userTest(); $adminProjects = $user->getObjectsTest('admin', 'project', 'all', 'id_desc'); @@ -23,4 +30,4 @@ r($adminProjects) && p('11:type') && e('project'); //获取admin的所属 r($adminExecutions) && p('120:name') && e('迭代20'); //获取admin的所属执行列表,取ID为120的项目名字 r($adminDoneProjects) && p('') && e('0'); //获取admin的已完成的所属项目列表,返回空 r($test2Projects) && p('') && e('0'); //获取test2用户的所属项目列表,返回空 -r($emptyUser) && p('') && e('0'); //传入一个空用户名字段,返回空 +r($emptyUser) && p('') && e('0'); //传入一个空用户名字段,返回空 \ No newline at end of file diff --git a/test/model/user/getpairs.php b/test/model/user/getpairs.php old mode 100644 new mode 100755 diff --git a/test/model/user/getparentstageauthedusers.php b/test/model/user/getparentstageauthedusers.php old mode 100644 new mode 100755 index 8cf13abcc5..08c4905f95 --- a/test/model/user/getparentstageauthedusers.php +++ b/test/model/user/getparentstageauthedusers.php @@ -10,10 +10,15 @@ title=测试 userModel::getParentStageAuthedUsersTest(); cid=1 pid=1 +传入ID为0的情况获取有权限的用户 >> 0 +传入一个阶段ID获取有权限的用户 >> admin +传入一个项目集ID获取有权限的用户 >> 0 +传入一个看板类型的项目ID获取有权限的用户 >> admin + */ $user = new userTest(); r($user->getParentStageAuthedUsersTest(0)) && p() && e('0'); //传入ID为0的情况获取有权限的用户 -r($user->getParentStageAuthedUsersTest(131)) && p('wwccss') && e('wwccss'); //传入一个阶段ID获取有权限的用户 +r($user->getParentStageAuthedUsersTest(131)) && p('admin') && e('admin'); //传入一个阶段ID获取有权限的用户 r($user->getParentStageAuthedUsersTest(1)) && p() && e('0'); //传入一个项目集ID获取有权限的用户 -r($user->getParentStageAuthedUsersTest(161)) && p('wwccss') && e('wwccss'); //传入一个看板类型的项目ID获取有权限的用户 +r($user->getParentStageAuthedUsersTest(161)) && p('admin') && e('admin'); //传入一个看板类型的项目ID获取有权限的用户 \ No newline at end of file diff --git a/test/model/user/getproductmembers.php b/test/model/user/getproductmembers.php new file mode 100755 index 0000000000..91d93393ad --- /dev/null +++ b/test/model/user/getproductmembers.php @@ -0,0 +1,32 @@ +#!/usr/bin/env php +getProductMembersTest(); +cid=1 +pid=1 + +获取ID为1的产品的团队成员,判断是否包含pm92 >> pm92 +获取ID为4的产品的团队成员,判断是否包含user5 >> user5 +获取ID为2的产品的干系人,判断是否包含po3 >> po3 +获取ID为3的产品的干系人,判断是否包含user14 >> user14 + +*/ + +$user = new userTest(); +$products = array(1 => 1, 2 => 2, 3 => 3, 4 => 4); + +$members = $user->getProductMembersTest($products); +$teamGroups = $members[0]; +$stakeholderGroups = $members[0]; + +r($teamGroups) && p('1:pm92') && e('pm92'); //获取ID为1的产品的团队成员,判断是否包含pm92 +r($teamGroups) && p('4:user5') && e('user5'); //获取ID为4的产品的团队成员,判断是否包含user5 +r($stakeholderGroups) && p('2:po3') && e('po3'); //获取ID为2的产品的干系人,判断是否包含po3 +r($stakeholderGroups) && p('3:user14') && e('user14'); //获取ID为3的产品的干系人,判断是否包含user14 + +system("./ztest init"); \ No newline at end of file diff --git a/test/model/user/getrealnameandemails.php b/test/model/user/getrealnameandemails.php old mode 100644 new mode 100755 diff --git a/test/model/user/getuserdisplayinfos.php b/test/model/user/getuserdisplayinfos.php old mode 100644 new mode 100755 diff --git a/test/model/user/getuserroles.php b/test/model/user/getuserroles.php old mode 100644 new mode 100755 diff --git a/test/model/user/getweakusers.php b/test/model/user/getweakusers.php new file mode 100644 index 0000000000..876e09d912 --- /dev/null +++ b/test/model/user/getweakusers.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getWeakUsersTest(); +cid=1 +pid=1 + +获取密码较弱的用户 >> 0 + +*/ +$user = new userTest(); +a($user->getWeakUsersTest());die; + +r($user->getWeakUsersTest()) && p('') && e('0'); //获取密码较弱的用户 \ No newline at end of file diff --git a/test/model/user/identify.php b/test/model/user/identify.php old mode 100644 new mode 100755 index 151821e18b..8bbbd7c80a --- a/test/model/user/identify.php +++ b/test/model/user/identify.php @@ -10,10 +10,14 @@ title=userModel->identifyTest(); cid=1 pid=1 +用户名密码皆正确,返回验证登录的用户 >> admin +验证一个不存在的用户,返回空 >> 0 +验证一个不传用户名和密码的用户,返回空 >> 0 + */ $user = new userTest(); r($user->identifyTest('admin', '78302615c8b79cac8df6d2607f8a83ee')) && p('realname') && e('admin'); //用户名密码皆正确,返回验证登录的用户 r($user->identifyTest('asdjaf12', '78302615c8b79cac8df6d2607f8a83ee')) && p() && e('0'); //验证一个不存在的用户,返回空 -r($user->identifyTest('', '')) && p() && e('0'); //验证一个不传用户名和密码的用户,返回空 +r($user->identifyTest('', '')) && p() && e('0'); //验证一个不传用户名和密码的用户,返回空 \ No newline at end of file diff --git a/test/model/user/login.php b/test/model/user/login.php old mode 100644 new mode 100755 index 94e54668d0..e7153b6034 --- a/test/model/user/login.php +++ b/test/model/user/login.php @@ -10,6 +10,10 @@ title=userModel->loginTest(); cid=1 pid=1 +使用admin登录,返回此用户为超级管理员 >> 1 +使用Admin登录,返回权限列表的数量 >> 3 +使用空账号登录,返回权限列表数量为0 >> 0 + */ $userClass = new userTest(); @@ -26,4 +30,4 @@ $emptyAccount = $userClass->loginTest($emptyAccount); r($admin) && p('admin') && e('1'); //使用admin登录,返回此用户为超级管理员 r(count($admin->rights)) && p() && e('3'); //使用Admin登录,返回权限列表的数量 -r(count($emptyAccount->group)) && p() && e('0'); //使用空账号登录,返回权限列表数量为0 +r(count($emptyAccount->group)) && p() && e('0'); //使用空账号登录,返回权限列表数量为0 \ No newline at end of file diff --git a/test/model/user/resetpassword.php b/test/model/user/resetpassword.php old mode 100644 new mode 100755 index ab0ec41dd5..021425e251 --- a/test/model/user/resetpassword.php +++ b/test/model/user/resetpassword.php @@ -10,14 +10,10 @@ title=userModel->resetPasswordTest(); cid=1 pid=1 -密码较弱的情况 >> 您的密码强度小于系统设定。 -Visions为空的情况 >> 『版本类型』不能为空。 -用户名为空的情况 >> 『用户名』不能为空。 -用户名特殊的情况 >> 『用户名』只能是字母、数字或下划线的组合三位以上。 +重设用户密码,返回重设后的加密后的密码 >> 367ef140036b0feb2f90d70d33255eea 两次密码不相同的情况 >> 两次密码应该相同。 -插入重复的用户名,返回报错信息 >> 『用户名』已经有『admin』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。 -正常插入用户,返回新插入的ID、真实姓名 >> 1001,新的测试用户 -正常插入用户,返回新插入的真实姓名 >> 新的测试用户 +密码强度小于系统设定 >> 您的密码强度小于系统设定。 +使用常见简单密码,给出错误提示 >> 密码不能使用【123456,password,12345,12345678,qwerty,123456789,1234,1234567,abc123,111111,123123】这些常用弱口令。 */ @@ -42,4 +38,4 @@ r($user->resetPasswordTest($normalUser)) && p('password') && e('367ef r($user->resetPasswordTest($differentPassword)) && p('password:0') && e('两次密码应该相同。'); //两次密码不相同的情况 r($user->resetPasswordTest($weakPassword)) && p('password1:0') && e('您的密码强度小于系统设定。'); //密码强度小于系统设定 r($user->resetPasswordTest($simplePassword)) && p('password1:0') && e('密码不能使用【123456,password,12345,12345678,qwerty,123456789,1234,1234567,abc123,111111,123123】这些常用弱口令。'); //使用常见简单密码,给出错误提示 -system("./ztest init"); +system("./ztest init"); \ No newline at end of file diff --git a/test/model/user/update.php b/test/model/user/update.php old mode 100644 new mode 100755 index 204a6d2718..b0d51613e3 --- a/test/model/user/update.php +++ b/test/model/user/update.php @@ -10,14 +10,10 @@ title=userModel->updateUserTest(); cid=1 pid=1 -密码较弱的情况 >> 您的密码强度小于系统设定。 -Visions为空的情况 >> 『版本类型』不能为空。 -用户名为空的情况 >> 『用户名』不能为空。 -用户名特殊的情况 >> 『用户名』只能是字母、数字或下划线的组合三位以上。 +编辑用户,返回新的用户名 >> newtestuser4 +编辑用户,有重名用户的情况 >> 『用户名』已经有『newtestuser4』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。 两次密码不相同的情况 >> 两次密码应该相同。 -插入重复的用户名,返回报错信息 >> 『用户名』已经有『admin』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。 -正常插入用户,返回新插入的ID、真实姓名 >> 1001,新的测试用户 -正常插入用户,返回新插入的真实姓名 >> 新的测试用户 +用户名包含特殊字符的情况 >> 『用户名』只能是字母、数字或下划线的组合三位以上。 */ @@ -44,4 +40,4 @@ r($user->updateUserTest(1000, $normalUser)) && p('account') && e('new r($user->updateUserTest(1000, $existUser)) && p('account:0') && e('『用户名』已经有『newtestuser4』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。');//编辑用户,有重名用户的情况 r($user->updateUserTest(1000, $differentPassword)) && p('password:0') && e('两次密码应该相同。'); //两次密码不相同的情况 r($user->updateUserTest(1000, $specialUser)) && p('account:0') && e('『用户名』只能是字母、数字或下划线的组合三位以上。'); //用户名包含特殊字符的情况 -system("./ztest init"); +system("./ztest init"); \ No newline at end of file diff --git a/test/model/user/updatecontactList.php b/test/model/user/updatecontactList.php new file mode 100644 index 0000000000..6ca6649ded --- /dev/null +++ b/test/model/user/updatecontactList.php @@ -0,0 +1,26 @@ +#!/usr/bin/env php +updateContactList(); +cid=1 +pid=1 + +更新ID为1的联系人列表,获取更新的联系人列表名称 >> 新的列表名称1 +更新ID为2的联系人列表,获取更新的联系人列表名称 >> 新的列表名称2 +更新ID为1000的联系人列表,获取更新的联系人列表 >> 0 + +*/ +$user = new userTest(); +$userList = array('admin,test2,user29,assfjg'); + +r($user->updateContactListTest(1, '新的列表名称1', $userList)) && p('listName') && e('新的列表名称1'); //更新ID为1的联系人列表,获取更新的联系人列表名称 +r($user->updateContactListTest(2, '新的列表名称2', $userList)) && p('listName') && e('新的列表名称2'); //更新ID为2的联系人列表,获取更新的联系人列表名称 +r($user->updateContactListTest(3, '新的列表名称3', '')) && p('userLsit') && e(''); //更新ID为3的联系人列表,获取更新的联系人列表 +r($user->updateContactListTest(1000, '新的列表名称4', $userList)) && p('userList') && e('0'); //更新ID为1000的联系人列表,获取更新的联系人列表 + +system("./ztest init"); \ No newline at end of file diff --git a/test/model/user/updatepassword.php b/test/model/user/updatepassword.php old mode 100644 new mode 100755 index 9e60a05a12..b78d289c7f --- a/test/model/user/updatepassword.php +++ b/test/model/user/updatepassword.php @@ -10,14 +10,9 @@ title=userModel->updatePasswordTest(); cid=1 pid=1 -密码较弱的情况 >> 您的密码强度小于系统设定。 -Visions为空的情况 >> 『版本类型』不能为空。 -用户名为空的情况 >> 『用户名』不能为空。 -用户名特殊的情况 >> 『用户名』只能是字母、数字或下划线的组合三位以上。 +编辑用户密码,返回编辑后的密码 >> dcf859ce8dd8f998bdfe4ae6c22c329e 两次密码不相同的情况 >> 两次密码应该相同。 -插入重复的用户名,返回报错信息 >> 『用户名』已经有『admin』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。 -正常插入用户,返回新插入的ID、真实姓名 >> 1001,新的测试用户 -正常插入用户,返回新插入的真实姓名 >> 新的测试用户 +密码小于设定强度的情况 >> 您的密码强度小于系统设定。 */ @@ -38,4 +33,4 @@ r($user->updatePasswordTest(1000, $normalUser)) && p('password') && e r($user->updatePasswordTest(1000, $differentPassword)) && p('password:0') && e('两次密码应该相同。'); //两次密码不相同的情况 r($user->updatePasswordTest(1000, $weakPassword)) && p('password1:0') && e('您的密码强度小于系统设定。'); //密码小于设定强度的情况 -system("./ztest init"); +system("./ztest init"); \ No newline at end of file