mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Реализован функционал Mojang API
Исправлена ошибка доступа к authserver из-за перехода на использование хостов, а не доменов
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
<?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);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user