mirror of
https://github.com/elyby/accounts.git
synced 2024-11-14 17:26:41 +05:30
df1859f0c1
Исправлена ошибка доступа к authserver из-за перехода на использование хостов, а не доменов
68 lines
2.2 KiB
PHP
68 lines
2.2 KiB
PHP
<?php
|
|
namespace tests\codeception\api\functional\authserver;
|
|
|
|
use tests\codeception\api\_pages\MojangApiRoute;
|
|
use tests\codeception\api\FunctionalTester;
|
|
|
|
class UsernameToUuidCest {
|
|
|
|
/**
|
|
* @var MojangApiRoute
|
|
*/
|
|
private $route;
|
|
|
|
public function _before(FunctionalTester $I) {
|
|
$this->route = new MojangApiRoute($I);
|
|
}
|
|
|
|
public function getUuidByUsername(FunctionalTester $I) {
|
|
$I->wantTo('get user uuid by his username');
|
|
$this->route->usernameToUuid('Admin');
|
|
$I->canSeeResponseCodeIs(200);
|
|
$I->canSeeResponseIsJson();
|
|
$I->canSeeResponseContainsJson([
|
|
'id' => 'df936908b2e1544d96f82977ec213022',
|
|
'name' => 'Admin',
|
|
]);
|
|
}
|
|
|
|
public function getUuidByUsernameAtMoment(FunctionalTester $I) {
|
|
$I->wantTo('get user uuid by his username at fixed moment');
|
|
$this->route->usernameToUuid('klik201', 1474404142);
|
|
$I->canSeeResponseCodeIs(200);
|
|
$I->canSeeResponseIsJson();
|
|
$I->canSeeResponseContainsJson([
|
|
'id' => 'd6b3e93564664cb886dbb5df91ae6541',
|
|
'name' => 'klik202',
|
|
]);
|
|
}
|
|
|
|
public function getUuidByUsernameAtWrongMoment(FunctionalTester $I) {
|
|
$I->wantTo('get 204 if passed once used, but changed username at moment, when it was changed');
|
|
$this->route->usernameToUuid('klik201', 1474404144);
|
|
$I->canSeeResponseCodeIs(204);
|
|
$I->canSeeResponseEquals('');
|
|
}
|
|
|
|
public function getUuidByUsernameWithoutMoment(FunctionalTester $I) {
|
|
$I->wantTo('get 204 if username not busy and not passed valid time mark, when it was busy');
|
|
$this->route->usernameToUuid('klik201');
|
|
$I->canSeeResponseCodeIs(204);
|
|
$I->canSeeResponseEquals('');
|
|
}
|
|
|
|
public function getUuidByWrongUsername(FunctionalTester $I) {
|
|
$I->wantTo('get user uuid by some wrong username');
|
|
$this->route->usernameToUuid('not-exists-user');
|
|
$I->canSeeResponseCodeIs(204);
|
|
$I->canSeeResponseEquals('');
|
|
}
|
|
|
|
public function nonPassedUsername(FunctionalTester $I) {
|
|
$I->wantTo('get 404 on not passed username');
|
|
$this->route->usernameToUuid('');
|
|
$I->canSeeResponseCodeIs(404);
|
|
}
|
|
|
|
}
|