From eea06315071a87a667ab6238f73080a90b7306be 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 11:03:44 +0800 Subject: [PATCH] * Add insert user test. --- test/api/users/getbyid.php | 2 +- test/api/users/insert | 16 ---------------- test/api/users/insert.php | 24 ++++++++++++++++++++++++ 3 files changed, 25 insertions(+), 17 deletions(-) delete mode 100755 test/api/users/insert create mode 100755 test/api/users/insert.php diff --git a/test/api/users/getbyid.php b/test/api/users/getbyid.php index 9f78e17ea7..d9f0f262d5 100755 --- a/test/api/users/getbyid.php +++ b/test/api/users/getbyid.php @@ -14,4 +14,4 @@ pid=1 global $token; $user = $rest->get('/users/2', array('token' => $token->token)); -r($user) && c(200) && p('realname') && e('测试1'); // 获取ID为2的真实姓名 +r($user) && c(200) && p('realname') && e('测试1'); // 获取ID为2的真实姓名 \ No newline at end of file diff --git a/test/api/users/insert b/test/api/users/insert deleted file mode 100755 index 6d45b22754..0000000000 --- a/test/api/users/insert +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env php -post('/tokens', array('account' => 'admin', 'password' => '123qwe!@#')); -$user = $rest->get('/users/2', array('token' => $token->body->token)); - -r($user) && c(200) && p('realname') && e('测试2'); // 插入一个新用户 diff --git a/test/api/users/insert.php b/test/api/users/insert.php new file mode 100755 index 0000000000..6a81af7f96 --- /dev/null +++ b/test/api/users/insert.php @@ -0,0 +1,24 @@ +#!/usr/bin/env php +> sgm0422@163.com + +*/ +global $token; +$insert = array( + 'account' => 'sgm', + 'password' => 'qaz19950422', + 'realname' => '孙广明', + 'gender' => 'm', + 'email' => 'sgm0422@163.com', +); +$user = $rest->post('/users', $insert, array('token' => $token->token)); + +r($user) && c(201) && p('email') && e('sgm0422@163.com'); // 插入一个新用户,获取邮箱 \ No newline at end of file