Skip to content

Commit

Permalink
remove haveHttpHeader tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hobbitronics committed Aug 6, 2024
1 parent 527ddb9 commit 419e323
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 91 deletions.
11 changes: 0 additions & 11 deletions application/tests/api/AuthCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public function test3(ApiTester $I)
{
$I->wantTo('check response when making a POST request for logging in');
$I->stopFollowingRedirects();
$I->haveHttpHeader('Authorization', 'Bearer user1');
$I->sendPOST('/auth/login');
$I->seeResponseCodeIs(302);
}
Expand All @@ -25,7 +24,6 @@ public function test33(ApiTester $I)
{
$I->wantTo('check response when making a PUT request for logging in');
$I->stopFollowingRedirects();
$I->haveHttpHeader('Authorization', 'Bearer user1');
$I->sendPUT('/auth/login');
$I->seeResponseCodeIs(405);
}
Expand All @@ -34,7 +32,6 @@ public function test34(ApiTester $I)
{
$I->wantTo('check response when making a DELETE request for logging in');
$I->stopFollowingRedirects();
$I->haveHttpHeader('Authorization', 'Bearer user1');
$I->sendDELETE('/auth/login');
$I->seeResponseCodeIs(405);
}
Expand All @@ -43,7 +40,6 @@ public function test35(ApiTester $I)
{
$I->wantTo('check response when making a OPTIONS request for logging in');
$I->stopFollowingRedirects();
$I->haveHttpHeader('Authorization', 'Bearer user1');
$I->sendOPTIONS('/auth/login');
$I->seeResponseCodeIs(405);
}
Expand All @@ -52,14 +48,12 @@ public function test4(ApiTester $I)
{
$I->wantTo('check response for making a GET request for logging out when already logged in');
$I->stopFollowingRedirects();
$I->haveHttpHeader('Authorization', 'Bearer user2');
$I->haveHttpHeader('X-Codeception-CodeCoverage', '');
$I->haveHttpHeader('HTTP_X_CODECEPTION_CODECOVERAGE', '');
$I->sendGET('/user/me');
$I->seeResponseCodeIs(200);
$I->sendGET('/auth/logout?access_token=user2');
$I->seeResponseCodeIs(302);
$I->haveHttpHeader('Authorization', 'Bearer user2');
$I->sendGET('/user/me');
$I->seeResponseCodeIs(401);
}
Expand All @@ -68,12 +62,10 @@ public function test5(ApiTester $I)
{
$I->wantTo('check response for making a GET request for logging out when already logged out');
$I->stopFollowingRedirects();
$I->haveHttpHeader('Authorization', 'Bearer user4');
$I->sendGET('/user/me');
$I->seeResponseCodeIs(401);
$I->sendGET('/auth/logout?access_token=user4');
$I->seeResponseCodeIs(302);
$I->haveHttpHeader('Authorization', 'Bearer user4');
$I->sendGET('/user/me');
$I->seeResponseCodeIs(401);
}
Expand All @@ -82,7 +74,6 @@ public function test6(ApiTester $I)
{
$I->wantTo('check response for making a POST request for logging out when already logged in');
$I->stopFollowingRedirects();
$I->haveHttpHeader('Authorization', 'Bearer user2');
$I->sendPOST('/auth/logout?access_token=user2');
$I->seeResponseCodeIs(405);
}
Expand All @@ -91,7 +82,6 @@ public function test7(ApiTester $I)
{
$I->wantTo('check response for making a PUT request for logging out when already logged in');
$I->stopFollowingRedirects();
$I->haveHttpHeader('Authorization', 'Bearer user2');
$I->sendPUT('/auth/logout?access_token=user2');
$I->seeResponseCodeIs(405);
}
Expand All @@ -100,7 +90,6 @@ public function test8(ApiTester $I)
{
$I->wantTo('check response for making a OPTIONS request for logging out when already logged in');
$I->stopFollowingRedirects();
$I->haveHttpHeader('Authorization', 'Bearer user2');
$I->sendOPTIONS('/auth/logout?access_token=user2');
$I->seeResponseCodeIs(200);
}
Expand Down
6 changes: 0 additions & 6 deletions application/tests/api/ConfigCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public function test1(ApiTester $I)
public function test12(ApiTester $I)
{
$I->wantTo('check response when making authenticated GET request to config');
$I->haveHttpHeader('Authorization', 'Bearer user1');
$I->sendGET('/config');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
Expand All @@ -39,7 +38,6 @@ public function test2(ApiTester $I)
public function test22(ApiTester $I)
{
$I->wantTo('check response when making authenticated POST request to config');
$I->haveHttpHeader('Authorization', 'Bearer user1');
$I->sendPOST('/config');
$I->seeResponseCodeIs(405);
}
Expand All @@ -54,7 +52,6 @@ public function test3(ApiTester $I)
public function test32(ApiTester $I)
{
$I->wantTo('check response when making authenticated PUT request to config');
$I->haveHttpHeader('Authorization', 'Bearer user1');
$I->sendPUT('/config');
$I->seeResponseCodeIs(405);
}
Expand All @@ -69,7 +66,6 @@ public function test4(ApiTester $I)
public function test42(ApiTester $I)
{
$I->wantTo('check response when making authenticated DELETE request to config');
$I->haveHttpHeader('Authorization', 'Bearer user1');
$I->sendDELETE('/config');
$I->seeResponseCodeIs(405);
}
Expand All @@ -84,7 +80,6 @@ public function test5(ApiTester $I)
public function test52(ApiTester $I)
{
$I->wantTo('check response when making authenticated PATCH request to config');
$I->haveHttpHeader('Authorization', 'Bearer user1');
$I->sendPATCH('/config');
$I->seeResponseCodeIs(405);
}
Expand All @@ -99,7 +94,6 @@ public function test6(ApiTester $I)
public function test7(ApiTester $I)
{
$I->wantTo('check response when making authenticated OPTIONS request to config');
$I->haveHttpHeader('Authorization', 'Bearer user1');
$I->sendOPTIONS('/config');
$I->seeResponseCodeIs(200);
}
Expand Down
18 changes: 0 additions & 18 deletions application/tests/api/MethodCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public function test1(ApiTester $I)
public function test2(ApiTester $I)
{
$I->wantTo('check response when making authenticated DELETE request to method');
$I->haveHttpHeader('Authorization', 'Bearer user1');
$I->sendDELETE('/method');
$I->seeResponseCodeIs(405);
}
Expand All @@ -29,7 +28,6 @@ public function test3(ApiTester $I)
public function test4(ApiTester $I)
{
$I->wantTo('check response when making authenticated PATCH request to method');
$I->haveHttpHeader('Authorization', 'Bearer user1');
$I->sendPATCH('/method');
$I->seeResponseCodeIs(405);
}
Expand All @@ -51,7 +49,6 @@ public function test6(ApiTester $I, $scenario)

$I->wantTo('check response that verified AND unverified methods exist when making authenticated GET'
. ' request for obtaining the methods of a user');
$I->haveHttpHeader('Authorization', 'Bearer user1');
$I->sendGET('/method');
$I->seeResponseCodeIs(200);

Expand All @@ -71,7 +68,6 @@ public function test62(ApiTester $I)
{
$I->wantTo('check response for authenticated GET request to method for a user'
. ' with auth_type=reset');
$I->haveHttpHeader('Authorization', 'Bearer user5');
$I->sendGET('/method');
$I->seeResponseCodeIs(403);
}
Expand All @@ -86,7 +82,6 @@ public function test7(ApiTester $I)
public function test8(ApiTester $I)
{
$I->wantTo('check response when making authenticated POST request for creating a new method');
$I->haveHttpHeader('Authorization', 'Bearer user1');
$I->sendPOST('/method', ['type' => 'email','value' => '[email protected]']);
$I->seeResponseCodeIs(200);
$I->seeResponseContainsJson([
Expand All @@ -99,7 +94,6 @@ public function test82(ApiTester $I, $scenario)
{
$I->wantTo('check response when making authenticated POST request for creating an'
. ' already existing method');
$I->haveHttpHeader('Authorization', 'Bearer user1');
$I->sendPOST('/method', ['type' => 'email','value' => '[email protected]']);

$I->seeResponseCodeIs(200);
Expand All @@ -109,7 +103,6 @@ public function test84(ApiTester $I)
{
$I->wantTo('check response for authenticated POST request to method for a user with'
. ' auth_type=reset');
$I->haveHttpHeader('Authorization', 'Bearer user5');
$I->sendPOST('/method', ['type' => 'email','value' => '[email protected]']);
$I->seeResponseCodeIs(403);
}
Expand All @@ -124,7 +117,6 @@ public function test9(ApiTester $I)
public function test10(ApiTester $I, $scenario)
{
$I->wantTo('check response when making authenticated GET request to obtain a method');
$I->haveHttpHeader('Authorization', 'Bearer user1');
$I->sendGET('/method/22222222222222222222222222222222');

$I->seeResponseCodeIs(200);
Expand All @@ -138,7 +130,6 @@ public function test102(ApiTester $I)
{
$I->wantTo('check response for authenticated GET request to method/{uid} for a user'
. ' with auth_type=reset');
$I->haveHttpHeader('Authorization', 'Bearer user5');
$I->sendGET('/method/55555555555555555555555555555555');
$I->seeResponseCodeIs(403);
}
Expand All @@ -147,7 +138,6 @@ public function test11(ApiTester $I)
{
$I->wantTo('check response when making authenticated GET request to obtain a method as'
. ' a non-owner of the method');
$I->haveHttpHeader('Authorization', 'Bearer user2');
$I->sendGET('/method/11111111111111111111111111111111');
$I->seeResponseCodeIs(404);
}
Expand All @@ -162,7 +152,6 @@ public function test12(ApiTester $I)
public function test13(ApiTester $I)
{
$I->wantTo('check response when making authenticated POST request method/id');
$I->haveHttpHeader('Authorization', 'Bearer user1');
$I->sendPOST('/method/11111111111111111111111111111111');
$I->seeResponseCodeIs(405);
}
Expand Down Expand Up @@ -258,7 +247,6 @@ public function test17(ApiTester $I, $scenario)
*/

$I->wantTo('check response when making authenticated DELETE request to method/id');
$I->haveHttpHeader('Authorization', 'Bearer user1');
$I->sendDELETE('/method/33333333333333333333333333333335');

$I->seeResponseCodeIs(204);
Expand All @@ -270,7 +258,6 @@ public function test172(ApiTester $I, $scenario)
{
$I->wantTo('check response when making authenticated DELETE request as a non-owner of'
. ' the method');
$I->haveHttpHeader('Authorization', 'Bearer user2');

$I->sendDELETE('/method/11111111111111111111111111111111');
$I->seeResponseCodeIs(404);
Expand All @@ -280,31 +267,27 @@ public function test174(ApiTester $I)
{
$I->wantTo('check response for authenticated DELETE request to method/{uid} for a user'
. ' with auth_type=reset');
$I->haveHttpHeader('Authorization', 'Bearer user5');
$I->sendDELETE('/method/55555555555555555555555555555555');
$I->seeResponseCodeIs(403);
}

public function test18(ApiTester $I)
{
$I->wantTo('check response when making authenticated PATCH request to method/id');
$I->haveHttpHeader('Authorization', 'Bearer user1');
$I->sendPATCH('/method/11111111111111111111111111111111');
$I->seeResponseCodeIs(405);
}

public function test19(ApiTester $I)
{
$I->wantTo('check response when making authenticated OPTIONS request to method/id');
$I->haveHttpHeader('Authorization', 'Bearer user1');
$I->sendOPTIONS('/method/11111111111111111111111111111111');
$I->seeResponseCodeIs(200);
}

public function test20(ApiTester $I)
{
$I->wantTo('check response when making PUT request to method/{uid}/resend with incorrect token');
$I->haveHttpHeader('Authorization', 'Bearer invalidToken');
$I->sendPUT('/method/11111111111111111111111111111111/resend');
$I->seeResponseCodeIs(401);
}
Expand All @@ -313,7 +296,6 @@ public function test21(ApiTester $I)
{
$I->wantTo('check response when making PUT request to method/{uid}/resend for a user'
. ' with auth_type=reset');
$I->haveHttpHeader('Authorization', 'Bearer user5');
$I->sendPUT('/method/55555555555555555555555555555555/resend');
$I->seeResponseCodeIs(403);
}
Expand Down
15 changes: 0 additions & 15 deletions application/tests/api/MfaCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class MfaCest extends BaseCest
public function test10(ApiTester $I)
{
$I->wantTo('check response when making GET request to /mfa with incorrect token');
$I->haveHttpHeader('Authorization', 'Bearer invalidToken');
$I->sendGET('/mfa');
$I->seeResponseCodeIs(401);
}
Expand All @@ -16,7 +15,6 @@ public function test11(ApiTester $I)
{
$I->wantTo('check response when making GET request to /mfa for a user'
. ' with auth_type=reset');
$I->haveHttpHeader('Authorization', 'Bearer user5');
$I->sendGET('/mfa');
$I->seeResponseCodeIs(403);
}
Expand All @@ -26,7 +24,6 @@ public function test11(ApiTester $I)
public function test20(ApiTester $I)
{
$I->wantTo('check response when making POST request to /mfa with incorrect token');
$I->haveHttpHeader('Authorization', 'Bearer invalidToken');
$I->sendPOST('/mfa');
$I->seeResponseCodeIs(401);
}
Expand All @@ -35,7 +32,6 @@ public function test21(ApiTester $I)
{
$I->wantTo('check response when making POST request to /mfa for a user'
. ' with auth_type=reset');
$I->haveHttpHeader('Authorization', 'Bearer user5');
$I->sendPOST('/mfa');
$I->seeResponseCodeIs(403);
}
Expand All @@ -45,7 +41,6 @@ public function test21(ApiTester $I)
public function test30(ApiTester $I)
{
$I->wantTo('check response when making PUT request to mfa/{id} with incorrect token');
$I->haveHttpHeader('Authorization', 'Bearer invalidToken');
$I->sendPUT('/mfa/1');
$I->seeResponseCodeIs(401);
}
Expand All @@ -54,15 +49,13 @@ public function test31(ApiTester $I)
{
$I->wantTo('check response when making PUT request to mfa/{id} for a user'
. ' with auth_type=reset');
$I->haveHttpHeader('Authorization', 'Bearer user5');
$I->sendPUT('/mfa/5');
$I->seeResponseCodeIs(403);
}

public function test33(ApiTester $I)
{
$I->wantTo('check response when making PUT request to mfa/{id}/webauthn/{webauthn_id} with incorrect token');
$I->haveHttpHeader('Authorization', 'Bearer invalidToken');
$I->sendPUT('/mfa/5/webauthn/6');
$I->seeResponseCodeIs(401);
}
Expand All @@ -71,7 +64,6 @@ public function test34(ApiTester $I)
{
$I->wantTo('check response when making PUT request to mfa/{id}/webauthn/{webauthn_id} for a user'
. ' with auth_type=reset');
$I->haveHttpHeader('Authorization', 'Bearer user5');
$I->sendPUT('/mfa/5/webauthn/6');
$I->seeResponseCodeIs(403);
}
Expand All @@ -81,7 +73,6 @@ public function test34(ApiTester $I)
public function test40(ApiTester $I)
{
$I->wantTo('check response when making DELETE request to mfa/{id} with incorrect token');
$I->haveHttpHeader('Authorization', 'Bearer invalidToken');
$I->sendDELETE('/mfa/1');
$I->seeResponseCodeIs(401);
}
Expand All @@ -90,15 +81,13 @@ public function test41(ApiTester $I)
{
$I->wantTo('check response when making DELETE request to mfa/{id} for a user'
. ' with auth_type=reset');
$I->haveHttpHeader('Authorization', 'Bearer user5');
$I->sendDELETE('/mfa/5');
$I->seeResponseCodeIs(403);
}

public function test42(ApiTester $I)
{
$I->wantTo('check response when making DELETE request to mfa/{id}/webauthn/{webauthn_id} with incorrect token');
$I->haveHttpHeader('Authorization', 'Bearer invalidToken');
$I->sendDELETE('/mfa/5/webauthn/6');
$I->seeResponseCodeIs(401);
}
Expand All @@ -107,7 +96,6 @@ public function test43(ApiTester $I)
{
$I->wantTo('check response when making DELETE request to mfa/{id}/webauthn/{webauthn_id} for a user'
. ' with auth_type=reset');
$I->haveHttpHeader('Authorization', 'Bearer user5');
$I->sendDELETE('/mfa/5/webauthn/6');
$I->seeResponseCodeIs(403);
}
Expand All @@ -117,7 +105,6 @@ public function test43(ApiTester $I)
public function test50(ApiTester $I)
{
$I->wantTo('check response when making PUT request to mfa/{id}/verify with incorrect token');
$I->haveHttpHeader('Authorization', 'Bearer invalidToken');
$I->sendPUT('/mfa/1/verify');
$I->seeResponseCodeIs(401);
}
Expand All @@ -126,7 +113,6 @@ public function test51(ApiTester $I)
{
$I->wantTo('check response when making PUT request to mfa/{id}/verify for a user'
. ' with auth_type=reset');
$I->haveHttpHeader('Authorization', 'Bearer user5');
$I->sendPUT('/mfa/5/verify');
$I->seeResponseCodeIs(403);
}
Expand All @@ -135,7 +121,6 @@ public function test52(ApiTester $I)
{
$I->wantTo('check response when making PUT request to mfa/{id}/verify/registration for a user'
. ' with auth_type=reset');
$I->haveHttpHeader('Authorization', 'Bearer user5');
$I->sendPUT('/mfa/5/verify/registration');
$I->seeResponseCodeIs(403);
}
Expand Down
Loading

0 comments on commit 419e323

Please sign in to comment.