Added missing tests for user deprecation feature
This commit is contained in:
parent
add7a01fac
commit
429da848c6
12
composer.lock
generated
12
composer.lock
generated
|
@ -2576,16 +2576,16 @@
|
|||
"packages-dev": [
|
||||
{
|
||||
"name": "amphp/amp",
|
||||
"version": "v2.6.0",
|
||||
"version": "v2.6.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/amphp/amp.git",
|
||||
"reference": "caa95edeb1ca1bf7532e9118ede4a3c3126408cc"
|
||||
"reference": "c5fc66a78ee38d7ac9195a37bacaf940eb3f65ae"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/amphp/amp/zipball/caa95edeb1ca1bf7532e9118ede4a3c3126408cc",
|
||||
"reference": "caa95edeb1ca1bf7532e9118ede4a3c3126408cc",
|
||||
"url": "https://api.github.com/repos/amphp/amp/zipball/c5fc66a78ee38d7ac9195a37bacaf940eb3f65ae",
|
||||
"reference": "c5fc66a78ee38d7ac9195a37bacaf940eb3f65ae",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2653,7 +2653,7 @@
|
|||
"support": {
|
||||
"irc": "irc://irc.freenode.org/amphp",
|
||||
"issues": "https://github.com/amphp/amp/issues",
|
||||
"source": "https://github.com/amphp/amp/tree/v2.6.0"
|
||||
"source": "https://github.com/amphp/amp/tree/v2.6.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -2661,7 +2661,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2021-07-16T20:06:06+00:00"
|
||||
"time": "2021-09-23T18:43:08+00:00"
|
||||
},
|
||||
{
|
||||
"name": "amphp/byte-stream",
|
||||
|
|
|
@ -63,7 +63,7 @@ services:
|
|||
- ./psalm.xml:/usr/src/code/psalm.xml
|
||||
- ./tests:/usr/src/code/tests
|
||||
- ./app:/usr/src/code/app
|
||||
# - ./vendor/utopia-php/database:/usr/src/code/vendor/utopia-php/database
|
||||
- ./vendor:/usr/src/code/vendor
|
||||
- ./docs:/usr/src/code/docs
|
||||
- ./public:/usr/src/code/public
|
||||
- ./src:/usr/src/code/src
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Tests\E2E\Services\Users;
|
||||
|
||||
use Tests\E2E\Client;
|
||||
use Tests\E2E\Scopes\ProjectCustom;
|
||||
use Tests\E2E\Scopes\Scope;
|
||||
use Tests\E2E\Scopes\SideServer;
|
||||
|
@ -11,4 +12,51 @@ class UsersCustomServerTest extends Scope
|
|||
use UsersBase;
|
||||
use ProjectCustom;
|
||||
use SideServer;
|
||||
|
||||
public function testDeprecatedUsers():array
|
||||
{
|
||||
/**
|
||||
* Test for FAILURE (don't allow recreating account with same custom ID)
|
||||
*/
|
||||
|
||||
// Create user with custom ID 'meldiron'
|
||||
$response = $this->client->call(Client::METHOD_POST, '/users', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'userId' => 'meldiron',
|
||||
'email' => 'matej@appwrite.io',
|
||||
'password' => 'my-superstr0ng-password',
|
||||
'name' => 'Matej Bačo'
|
||||
]);
|
||||
|
||||
$this->assertEquals(201, $response['headers']['status-code']);
|
||||
|
||||
// Delete user with custom ID 'meldiron'
|
||||
$response = $this->client->call(Client::METHOD_DELETE, '/users/meldiron', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
|
||||
]);
|
||||
|
||||
$this->assertEquals(204, $response['headers']['status-code']);
|
||||
|
||||
// Try to create user with custom ID 'meldiron' again, but now it should fail
|
||||
$response1 = $this->client->call(Client::METHOD_POST, '/users', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'userId' => 'meldiron',
|
||||
'email' => 'matej@appwrite.io',
|
||||
'password' => 'my-superstr0ng-password',
|
||||
'name' => 'Matej Bačo'
|
||||
]);
|
||||
|
||||
$this->assertEquals(409, $response1['headers']['status-code']);
|
||||
$this->assertEquals('Account already exists', $response1['body']['message']);
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue