From 6cbf8074f28bd7e8db419e64ea470db7f21e75b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B9=BF=E6=98=8E?= Date: Tue, 19 Oct 2021 15:46:57 +0800 Subject: [PATCH] * Add cases of user. --- test/api/users/delete.php | 18 ++++++++++++++++++ test/api/users/edit.php | 17 +++++++++++++++++ test/api/users/getbyid.php | 0 test/api/users/getlist.php | 18 ++++++++++++++++++ test/api/users/insert.php | 1 - 5 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 test/api/users/delete.php create mode 100644 test/api/users/edit.php mode change 100755 => 100644 test/api/users/getbyid.php create mode 100644 test/api/users/getlist.php mode change 100755 => 100644 test/api/users/insert.php diff --git a/test/api/users/delete.php b/test/api/users/delete.php new file mode 100644 index 0000000000..34aa2671ff --- /dev/null +++ b/test/api/users/delete.php @@ -0,0 +1,18 @@ +#!use/bin/env php +> message:success + +*/ + +global $token; +$result = $rest->delete('/users/10', array('token' => $token->token)); + +r($result) && c(200) && p() && e("message:success") ; //删除ID为10的用户,判断返回信息 diff --git a/test/api/users/edit.php b/test/api/users/edit.php new file mode 100644 index 0000000000..60bb708d0a --- /dev/null +++ b/test/api/users/edit.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +> 李铁柱 + +*/ +global $token; +$user = $rest->put('/users/3', array('realname' => '李铁柱'), array('token' => $token->token)); + +r($user) && c(200) && p('realname') && e('李铁柱'); // 编辑ID为3的用户,获取真实姓名 \ No newline at end of file diff --git a/test/api/users/getbyid.php b/test/api/users/getbyid.php old mode 100755 new mode 100644 diff --git a/test/api/users/getlist.php b/test/api/users/getlist.php new file mode 100644 index 0000000000..548ecabcbd --- /dev/null +++ b/test/api/users/getlist.php @@ -0,0 +1,18 @@ +#!use/bin/env php +> admin,测试1 + +*/ + +global $token; +$list = $rest->get('/users?page=1&limit=2&order=id_asc', array('token' => $token->token)); + +r($list->body->users) && p('realname') && e('admin,测试1'); //获取用户列表,判断ID为1和2的真实姓名 \ No newline at end of file diff --git a/test/api/users/insert.php b/test/api/users/insert.php old mode 100755 new mode 100644 index 6a81af7f96..d39d497166 --- a/test/api/users/insert.php +++ b/test/api/users/insert.php @@ -16,7 +16,6 @@ $insert = array( 'account' => 'sgm', 'password' => 'qaz19950422', 'realname' => '孙广明', - 'gender' => 'm', 'email' => 'sgm0422@163.com', ); $user = $rest->post('/users', $insert, array('token' => $token->token));