Skip to content

Commit 04479c6

Browse files
committed
add get test
1 parent 5ec1800 commit 04479c6

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

tests/ApiCest.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<?php
2+
3+
declare(strict_types=1);
4+
25
namespace Tests;
36

7+
use Codeception\Util\HttpCode;
48
use Tests\Support\ApiTester;
59

610
class ApiCest
@@ -20,8 +24,20 @@ public function createUser(ApiTester $I): void
2024
]
2125
);
2226

23-
$I->seeResponseCodeIs(201);
27+
$I->seeResponseCodeIs(HttpCode::CREATED);
28+
$I->seeResponseIsJson();
29+
$I->seeResponseContains('username');
30+
}
31+
32+
public function getUser(ApiTester $I): void
33+
{
34+
$bearerToken = getenv('API_BEARER_TOKEN');
35+
$I->amBearerAuthenticated($bearerToken);
36+
$I->sendGet(self::USERS_URL);
37+
38+
$I->seeResponseCodeIs(HttpCode::OK);
2439
$I->seeResponseIsJson();
2540
$I->seeResponseContains('username');
41+
$I->seeResponseContains('gender');
2642
}
2743
}

0 commit comments

Comments
 (0)