public function testCaptureFlag()
 {
     $token = $this->doLogin('*****@*****.**', '123456');
     $this->tester->haveHttpHeader('Content-type', 'application/json');
     $this->tester->haveHttpHeader('X-Api-token', $token);
     $region = rand(1, 4);
     $this->tester->sendPOST('/api/capture-flag', json_encode(['regionId' => $region]));
     $this->tester->seeResponseCodeIs(200);
     $this->tester->seeResponseIsJson();
     $this->tester->haveHttpHeader('Content-type', 'application/json');
     $this->tester->haveHttpHeader('X-Api-token', $token);
     $this->tester->sendGET('/api/player-status');
     $this->tester->seeResponseCodeIs(200);
     $this->tester->seeResponseIsJson();
     $data = json_decode($this->tester->grabResponse(), true);
     $myTeamId = $data['data']['id'];
     $this->tester->haveHttpHeader('Content-type', 'application/json');
     $this->tester->sendGET('/api/game-status/1');
     $this->tester->seeResponseCodeIs(200);
     $this->tester->seeResponseIsJson();
     $data = json_decode($this->tester->grabResponse(), true);
     $data = $data['data'];
     $this->assertArrayHasKey('ownerRegion1', $data);
     $this->assertArrayHasKey('ownerRegion2', $data);
     $this->assertArrayHasKey('ownerRegion3', $data);
     $this->assertArrayHasKey('ownerRegion4', $data);
     //        $this->assertEquals($data['ownerRegion' . $region]['id'], $myTeamId);
 }
 private function checkLocationList()
 {
     $this->tester->seeResponseCodeIs(200);
     $this->tester->seeResponseIsJson();
     $this->tester->seeResponseJsonMatchesJsonPath('$.status');
     $this->tester->seeResponseJsonMatchesJsonPath('$.data');
     $this->tester->seeResponseJsonMatchesJsonPath('$.data[0].lat');
     $this->tester->seeResponseJsonMatchesJsonPath('$.data[0].lng');
     $this->tester->seeResponseJsonMatchesJsonPath('$.data[0].game');
 }
 public function doCheckLogout($token)
 {
     // Do Logout
     $this->tester->haveHttpHeader('Content-type', 'application/json');
     $this->tester->haveHttpHeader('X-Api-Token', $token);
     $this->tester->sendPOST('/api/logout');
     $this->tester->seeResponseCodeIs(200);
     $this->tester->seeResponseIsJson();
     // Check is logged out
     $this->checkIsLogin($token, false);
 }
 /**
  * @depends update
  */
 public function delete(ApiTester $I)
 {
     $I->wantTo('Delete a new Contact in com_contacts using DELETE');
     $I->amHttpAuthenticated('admin', 'admin');
     $I->sendDELETE('index.php' . '?option=contact' . '&api=Hal' . '&webserviceClient=administrator' . '&webserviceVersion=1.0.0' . "&id={$this->id}");
     $I->seeResponseCodeIs(200);
     $I->sendGET('index.php' . '?option=contact' . '&api=Hal' . '&webserviceClient=administrator' . '&webserviceVersion=1.0.0' . "&id={$this->id}");
     $I->seeResponseCodeIs(404);
     $I->seeResponseIsJson();
     $I->seeResponseContains('"message":"Item not found with given key.","code":404,"type":"Exception"');
 }
 public function createPost(ApiTester $I)
 {
     $I->sendPOST($this->endpoint, ['title' => 'Game of Rings', 'body' => 'By George Tolkien']);
     $I->seeResponseCodeIs(200);
     $I->seeResponseIsJson();
     $I->seeResponseContainsJson(['title' => 'Game of Rings']);
     $id = $I->grabDataFromJsonResponse('id');
     $I->seeRecord('posts', ['id' => $id, 'title' => 'Game of Rings']);
     $I->sendGET($this->endpoint . "/{$id}");
     $I->seeResponseCodeIs(200);
     $I->seeResponseIsJson();
     $I->seeResponseContainsJson(['title' => 'Game of Rings']);
 }
예제 #6
0
 public function testTestUsersCreation(ApiTester $I)
 {
     $I->wantTo('make sure my test users have been created');
     $I->amHttpAuthenticated('admin', 'admin');
     $I->sendGET($this->baseUrl . '/users/' . $this->userId);
     $I->seeResponseCodeIs(200);
     $I->seeResponseIsXml();
     $I->seeXmlResponseIncludes(XmlUtils::toXml(['status' => 'ok']));
     $I->sendGET($this->baseUrl . '/users/' . $this->sharerUserId);
     $I->seeResponseCodeIs(200);
     $I->seeResponseIsXml();
     $I->seeXmlResponseIncludes(XmlUtils::toXml(['status' => 'ok']));
 }
 public function deletePost(ApiTester $I)
 {
     $id = $I->haveRecord('posts', $this->getPostAttributes(['title' => 'Game of Thrones']));
     $I->sendDELETE($this->endpoint . "/{$id}");
     $I->seeResponseCodeIs(200);
     $I->dontSeeRecord('posts', ['id' => $id]);
 }
 public function deleteUser(ApiTester $I, \Codeception\Scenario $scenario)
 {
     //$scenario->skip('ownCloud master is broken');
     $I->wantTo('delete the user');
     $I->amHttpAuthenticated('admin', 'admin');
     $I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
     $I->sendDELETE($this->apiUrl . '/users/' . $this->userId);
     $I->seeResponseCodeIs(200);
     $I->seeResponseIsXml();
     $I->seeXmlResponseIncludes(XmlUtils::toXml(['status' => 'ok']));
 }
예제 #9
0
 public function deleteDiscussion(ApiTester $I)
 {
     $I->wantTo('delete a discussion via API');
     $user = $I->amAuthenticated();
     $user->groups()->attach(4);
     // Make the user a moderator
     $discussion = Factory::create('Flarum\\Core\\Models\\Discussion', ['start_user_id' => $user->id]);
     $I->sendDELETE($this->endpoint . '/' . $discussion->id);
     $I->seeResponseCodeIs(204);
     $I->seeResponseEquals('');
     $I->expect('the discussion was deleted in the database');
     $I->dontSeeRecord('discussions', ['id' => $discussion->id]);
 }
예제 #10
0
 private function checkStatList()
 {
     $this->tester->seeResponseCodeIs(200);
     $this->tester->seeResponseIsJson();
     $data = json_decode($this->tester->grabResponse(), true);
     $this->tester->seeResponseJsonMatchesJsonPath('$.status');
     $this->tester->seeResponseJsonMatchesJsonPath('$.data');
     foreach ($data['data']['stats'] as $item) {
         $this->assertArrayHasKey('team', $item);
         $this->assertArrayHasKey('player', $item);
         $this->assertArrayHasKey('id', $item['player']);
         $this->assertArrayHasKey('alias', $item['player']);
         $this->assertArrayHasKey('level', $item['player']);
         $this->assertArrayHasKey('isLive', $item['player']);
         $this->assertArrayHasKey('isLive', $item);
         $this->assertArrayHasKey('location', $item);
         $this->assertArrayHasKey('player', $item['location']);
         $this->assertArrayHasKey('lat', $item['location']);
         $this->assertArrayHasKey('lng', $item['location']);
         $this->assertArrayHasKey('game', $item['location']);
     }
 }
예제 #11
0
<?php

use Codeception\Util\Fixtures;
/** @var Faker\Generator $faker */
$faker = Fixtures::get('faker');
$devs = Fixtures::get('devs');
$I = new ApiTester($scenario);
$I->wantTo('get the user price based on the GitHub API');
$I->amGoingTo('Get a non-existent user');
$I->sendGET('dev/' . $faker->lexify('??????????'));
$I->seeResponseCodeIs(404);
$I->amGoingTo('Get an existent user');
$I->sendGET('dev/' . $devs[array_rand($devs)]);
$I->seeResponseCodeIs(200);
$dev = json_decode($I->grabResponse());
$I->assertTrue(is_numeric($dev->rate), 'rate is numeric');
$I->assertTrue(is_string($dev->username) && strlen($dev->username) != 0, 'username is present and is string');
예제 #12
0
파일: UpdateCept.php 프로젝트: GM-Team/web
<?php

$request_body = ['interaction_id' => 'SD000000099', 'category' => 'Laptop', 'issue' => 'Wont turn on!', 'status' => 'Submitted', 'description' => 'Yes, I have it plugged in!', 'affected_service' => 'Laptop', 'notify_type' => 'CALLME', 'phase' => 'WIP', 'last_update_date' => '7-7-17, 7:57:57 PM EDT'];
$response_body = ['status' => 'Successful update'];
$I = new ApiTester($scenario);
$I->wantTo('update a ticket');
$I->haveHttpHeader('Content-Type', 'application/json');
$I->sendPOST('/tickets/', $request_body);
$I->seeResponseCodeIs(201);
$I->seeResponseIsJson();
$I->seeResponseContainsJson($response_body);
예제 #13
0
 /**
  * @param \ApiTester $I
  */
 public function missingRateError(ApiTester $I)
 {
     $I->wantTo('Error while saving: missing rate.');
     $I->sendPost('http://currencyfairtest.com/api/messages', ["userId" => "100", "currencyFrom" => "EUR", "amountSell" => "999.0000", "timePlaced" => "31-AUG-15 22:00:00"]);
     $I->seeResponseCodeIs(400);
     $I->seeResponseIsJson();
     $I->seeResponseContains('ERROR');
     $I->seeResponseContains('rate');
     $I->seeResponseContains('The rate field is required.');
 }
<?php

$I = new ApiTester($scenario);
$I->wantTo('get new pid for a user');
$I->haveHttpHeader(' Content-Type', 'xxyyzz');
$I->sendPOST('http://localhost/api/v1/action/GetPid.php', json_encode(array('action' => 'GetPid')));
$I->seeResponseCodeIs(400);
$I->seeResponseIsJson();
예제 #15
0
<?php

include 'version.php';
$I = new ApiTester($scenario);
$I->wantTo('fetch the version information for the web app');
$I->sendGET('version');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContainsJson(["api_version" => $api_version, "app_version" => $app_version, "webapp_version" => $webapp_version]);
예제 #16
0
<?php

use Aws\Glacier\TreeHash;
$I = new ApiTester($scenario);
$I->wantTo('Upload, retrieve and delete an archive.');
$I->haveAuth();
$I->sendPUT('/-/vaults/testvault');
$I->seeResponseCodeIs(201);
$data = '';
$archiveSize = 1024 * 1024 + 10;
for ($i = 0; $i < $archiveSize; $i++) {
    $data .= chr(rand(0, 255));
}
$data[0] = 'A';
$data[1] = 'B';
$data[2] = 'C';
$data[3] = 'D';
$treeHash = new TreeHash();
$treeHash->update($data);
$treeHash = bin2hex($treeHash->complete());
$hash = hash('sha256', $data);
$I->haveHttpHeader('Content-Type', 'application/octet-stream');
$I->haveHttpHeader('x-amz-archive-description', 'test123');
$I->haveHttpHeader('x-amz-sha256-tree-hash', $treeHash);
$I->haveHttpHeader('x-amz-content-sha256', $hash);
$I->sendPOST('/-/vaults/testvault/archives', $data);
$I->seeResponseCodeIs(201);
$I->seeResponseEquals('');
$archiveID = $I->grabHttpHeader('x-amz-archive-id');
$I->haveHttpHeader('Content-Type', 'application/json');
$I->sendPOST('/-/vaults/testvault/jobs', ['Type' => 'archive-retrieval', 'ArchiveId' => $archiveID]);
 public function unknownDeviceSystemMessage(ApiTester $I)
 {
     $I->am('sending a valid system message');
     $I->wantTo('confirm it is received and handled correctly');
     //Post the keyfob to the endpoint
     $I->sendPOST('/access-control/main-door', ['data' => ':unknown|unknown']);
     //The endpoint always returns 200
     $I->seeResponseCodeIs(200);
     //Confirm an access log record was created
     //$I->seeInDatabase('access_log', ['user_id'=>$user->id, 'key_fob_id'=>$keyFob->id, 'response'=>200, 'service'=>'main-door']);
 }
예제 #18
0
 public function updateMetaInvalid(ApiTester $I)
 {
     $I->createAndLoginUser();
     $I->createProjectAndSetHeader();
     $I->createTable($I->getTableShortData());
     $decision = $I->makeDecision($I->getResponseFields()->data->_id, ['bool' => true, 'numeric' => 123, 'string' => 'Yes']);
     $data = array_fill(0, 20, 'test');
     $data[str_repeat('2', 101)] = 'ok';
     $data['invalid#'] = 'ok';
     $data['stringLength'] = str_repeat('1', 501);
     $data['array'] = [];
     $data[] = [['array']];
     $I->sendPUT("api/v1/admin/decisions/{$decision->_id}/meta", ['meta' => $data]);
     $I->seeResponseCodeIs(422);
     $I->canSeeResponseJsonMatchesJsonPath('$.data.meta_keys_amount');
     $I->canSeeResponseJsonMatchesJsonPath('$.data.key_20');
     $I->canSeeResponseJsonMatchesJsonPath('$.data.key_21');
     $I->canSeeResponseJsonMatchesJsonPath('$.data.key_22_value');
     $I->canSeeResponseJsonMatchesJsonPath('$.data.key_23_value');
     $I->canSeeResponseJsonMatchesJsonPath('$.data.key_24_value');
     $I->sendPUT("api/v1/admin/decisions/{$decision->_id}/meta", $data);
     $I->seeResponseCodeIs(422);
     $I->canSeeResponseJsonMatchesJsonPath('$.data.meta');
     $I->sendPUT("api/v1/admin/decisions/{$decision->_id}/meta", []);
     $I->seeResponseCodeIs(422);
     $I->canSeeResponseJsonMatchesJsonPath('$.data.meta');
 }
예제 #19
0
<?php

$I = new ApiTester($scenario);
$I->wantTo('create a new device');
$user = $I->haveAnAccount();
$I->amHttpAuthenticated($user['email'], $user['password']);
$I->sendPOST('devices', ['mac' => '00:19:20:A1:B4:FC', 'name' => 'Manuel']);
$I->seeResponseCodeIs(422);
$I->seeResponseIsJson();
$I->sendPOST('devices', ['ip' => '192.168.1.123', 'mac' => '00:19:20:A1:B4:FC', 'name' => 'Manuel']);
$I->seeResponseCodeIs(201);
$I->seeHttpHeader('Location', 'http://localhost/api/v1/devices/1');
$I->seeResponseIsJson();
$I->seeResponseContainsJson(['data' => ['ip' => '192.168.1.123', 'name' => 'Manuel', 'on_home_page' => 'auto', 'group' => null]]);
$I->seeResponseJsonMatchesXpath('//data//device_added');
$I->seeResponseJsonMatchesXpath('//data//last_contact');
$I->seeRecord('devices', ['ip' => '192.168.1.123', 'mac' => '00:19:20:A1:B4:FC', 'name' => 'Manuel', 'public' => 'auto', 'group' => null]);
<?php

$I = new ApiTester($scenario);
$I->wantTo('check login via POST with wrong credentials');
$I->haveHttpHeader('Content-Type', 'application/json;charset=utf-8');
$I->haveHttpHeader('Accept', 'application/json;charset=utf-8');
$I->sendPOST('login', json_encode(array('username' => 'demo', 'password' => 'somewrongpassword1234')));
$I->seeResponseCodeIs(401);
$I->seeResponseIsJson();
$I->seeResponseContainsJson(array('error' => true, 'message' => "Login failed. Incorrect credentials"));
예제 #21
0
 public function variantsProbabilityInvalid(ApiTester $I)
 {
     $I->createAndLoginUser();
     $I->createProjectAndSetHeader();
     # invalid variants_probability
     $data = $I->getTableShortData();
     $data['variants_probability'] = 'invalid';
     $I->sendPOST('api/v1/admin/tables', $data);
     $I->seeResponseCodeIs(422);
     $I->seeResponseContains('variants_probability');
     # more than 100
     $data['variants_probability'] = 'percent';
     $data['variants'][0]['probability'] = 30;
     $data['variants'][0]['title'] = 'Variant 1';
     $data['variants'][1] = ['title' => 'Variant 2', 'default_title' => 'Variant 2', 'default_description' => 'Description Variant 2', 'default_decision' => 'Decline', 'probability' => 71, 'rules' => $I->getVariantRules()];
     $I->sendPOST('api/v1/admin/tables', $data);
     $I->seeResponseCodeIs(422);
     $I->seeResponseContains('variants_probability');
     # less than 100
     $data['variants'][0]['probability'] = 28;
     $I->sendPOST('api/v1/admin/tables', $data);
     $I->seeResponseCodeIs(422);
     $I->seeResponseContains('variants_probability');
 }
예제 #22
0
 public function serversRespondsWitJson(ApiTester $I)
 {
     $I->sendGET($this->endpoint . SOURCE);
     $I->seeResponseCodeIs(200);
     $I->seeResponseIsJson();
 }
예제 #23
0
 public function canNotEditItself(ApiTester $I)
 {
     $user = $I->createAndLoginUser();
     $I->createProjectAndSetHeader();
     $I->sendPUT('api/v1/projects/users', ['user_id' => $user->_id, 'role' => 'manager', 'scope' => ['tables_view', 'tables_update', 'users_manage']]);
     $I->seeResponseCodeIs(403);
     $I->loginClient($I->getCurrentClient());
     $second_user = $I->createUser(true);
     $I->loginUser($user);
     $I->sendPOST('api/v1/projects/users', ['user_id' => $second_user->_id, 'role' => 'manager', 'scope' => ['tables_view', 'tables_update', 'users_manage']]);
     $I->seeResponseCodeIs(201);
     $I->loginUser($second_user);
     $I->sendPUT('api/v1/projects/users', ['user_id' => $user->_id, 'role' => 'manager', 'scope' => ['tables_view', 'tables_update', 'users_manage']]);
     $I->seeResponseCodeIs(403);
     $I->loginUser($user);
     $I->sendPOST('api/v1/projects/users/admin', ['user_id' => $second_user->_id]);
     $I->seeResponseCodeIs(200);
     $I->loginUser($second_user);
     $I->sendPUT('api/v1/projects/users', ['user_id' => $user->_id, 'role' => 'manager', 'scope' => ['tables_view', 'tables_update', 'users_manage']]);
     $I->seeResponseCodeIs(200);
 }
 function obtainAuthCodeGrant(ApiTester $I)
 {
     $user = factory(App\Models\User::class, 1)->create();
     $user->password = '******';
     $user->save();
     $I->amLoggedAs($user);
     $client = factory(App\Models\OAuthClient::class, 1)->create();
     $grant = \App\Models\OAuthGrant::find('authorization_code');
     $client->oauth_grants()->attach($grant);
     $scope = \App\Models\OAuthScope::find('user_read');
     $client->oauth_scopes()->attach($scope);
     $endpoint = factory(App\Models\OAuthClientEndpoint::class, 1)->make();
     $endpoint->oauth_client()->associate($client);
     $endpoint->save();
     $I->wantTo('Perform a full 3rd party authorisation flow and get an access token');
     $I->amOnPage('authorize?client_id=' . $client->id . '&redirect_uri=' . $endpoint->redirect_uri . '&response_type=code&scope=user_read');
     $I->click('approve');
     $I->seeInCurrentUrl('code=');
     $url = Request::fullUrl();
     $parts = parse_url($url);
     parse_str($parts['query'], $query);
     $code = $query['code'];
     $I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
     $I->sendPOST('oauth/access_token', ['grant_type' => 'authorization_code', 'client_id' => $client->id, 'client_secret' => $client->secret, 'redirect_uri' => $endpoint->redirect_uri, 'code' => $code]);
     $I->seeResponseCodeIs(200);
     $I->seeResponseIsJson();
     $I->seeResponseMatchesJsonType(['access_token' => 'string']);
 }
예제 #25
0
<?php

$I = new ApiTester($scenario);
$I->wantTo('Test the cart behaviour with items');
$I->amGoingTo('confirm the cart is empty');
$I->sendGET('cart');
$I->seeCodeAndJson(200, ['items' => [], 'total' => floatify(0)]);
/**
 * @var array $item1
 * @var array $item2
 * @var int   $item_id
 */
require "_AddItems.php";
$I->amGoingTo('Verify order');
$I->sendGET('cart');
$I->expectTo('see items in order');
$I->seeCodeAndJson(200, ['items' => [$item1, $item2]]);
$I->expectTo('see correct total');
$I->seeResponseContainsJson(['total' => floatify($item1['final_price'] + $item2['final_price'])]);
$I->amGoingTo('delete an item');
$I->sendDELETE('cart/item/' . $item_id);
$I->seeResponseCodeIs(204);
$I->seeResponseEquals('');
$I->sendGET('cart');
$I->seeCodeAndJson(200, ['items' => [$item2], 'total' => floatify($item2['final_price'])]);
$I->amGoingTo('clear the cart');
$I->sendDELETE('cart');
$I->seeResponseCodeIs(204);
$I->seeResponseEquals('');
$I->sendGET('cart');
$I->seeCodeAndJson(200, ['items' => [], 'total' => floatify(0)]);
예제 #26
0
<?php

$I = new ApiTester($scenario);
$I->wantTo('Create a new vault.');
$I->sendPUT('/-/vaults/testvault');
$I->seeResponseCodeIs(403);
$I->haveAuth();
$I->sendPUT('/-/vaults/testvault');
$I->seeResponseCodeIs(201);
$I->seeResponseEquals('');
$I->haveAuth();
$I->sendDELETE('/-/vaults/testvault');
$I->seeResponseCodeIs(204);
$I->seeResponseEquals('');
예제 #27
0
/**
 * @var array    $item1
 * @var array    $item2
 * @var int      $order
 * @var callable $gen_item
 */
require "_AddItems.php";
$calculate_discount = function ($discount, ...$items) {
    $mult = 1 - $discount;
    return array_reduce($items, function ($total, $item) use($mult) {
        return floatify($total + floatify($item['final_price'] * $mult));
    }, 0);
};
$I->amGoingTo('use an invalid coupon code');
$I->sendPOST('cart/coupon', ['code' => 'XXX']);
$I->seeResponseCodeIs(HTTP_NOT_FOUND);
$set_coupon = function ($coupon) use($I, $item1, $item2, $calculate_discount) {
    $I->sendPOST('cart/coupon', ['code' => $coupon['code']]);
    $I->seeCodeAndJson(HTTP_OK, $coupon);
    $I->sendGET('cart');
    $I->seeResponseContainsJson(['total' => $calculate_discount($coupon['discount'], $item1, $item2)]);
};
$I->amGoingTo('use a valid coupon code');
$set_coupon($coupons[0]);
$I->amGoingTo('change the coupon');
$set_coupon($coupons[1]);
$I->amGoingTo('add a new item to see the price discount');
$item3 = $gen_item();
$I->sendPUT('cart', $item3);
$item3['final_price'] = $item3['price'] * $item3['qty'];
$I->sendGET('cart');
예제 #28
0
파일: GamesCept.php 프로젝트: AndriyK/team
<?php

$I = new ApiTester($scenario);
$I->wantTo('check games resource');
$I->sendGET('/teams/26?expand=games');
$I->seeResponseCodeIs(401);
$token = $I->login('q@q.q', 'q');
// show list of games for team
$I->haveHttpHeader('Authorization', "Bearer {$token}");
$I->sendGET('/teams/26?expand=games');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContains('games');
$games = $I->grabDataFromResponseByJsonPath('$.games')[0];
\PHPUnit_Framework_Assert::assertEquals(2, count($games));
$I->seeResponseContains('training');
$I->seeResponseContains('evening game');
// check for empty list for team with no games
$I->sendGET('/teams/27?expand=games');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContains('games');
$games = $I->grabDataFromResponseByJsonPath('$.games')[0];
\PHPUnit_Framework_Assert::assertEquals(0, count($games));
// create game
$I->sendPOST('/games', ['team_id' => 26, 'datetime' => date("Y-m-d H:i:s"), 'location' => "home", 'title' => "important game"]);
$I->seeResponseCodeIs(201);
$I->seeResponseIsJson();
$I->seeResponseContains('important game');
$I->seeResponseContains('home');
$gameId = $I->grabDataFromResponseByJsonPath('$.id')[0];
<?php

$I = new ApiTester($scenario);
$I->wantTo('Get a 404 when I want to delete an asset that does not exist');
$I->haveHttpHeader('Content-Type', 'application/json;charset=utf-8');
$I->haveHttpHeader('X-Hash', 'e651e0f6450f89d82ab0a34c1d421097a635897f5e719179e49263ff145e6ed9');
$I->haveHttpHeader('X-PublicKey', '248512b6a66f365a4e42f10ed0c854844767b8ca8eb0f74589953991e9f233b6');
$I->sendDELETE('asset/xyz123456', '');
$I->seeResponseCodeIs(404);
예제 #30
0
 public function getConsumers(ApiTester $I)
 {
     $user = $I->createAndLoginUser();
     $I->createProjectAndSetHeader();
     $I->loginClient($I->getCurrentClient());
     $second_user = $I->createUser(true);
     $I->loginUser($user);
     $I->sendGET('api/v1/projects');
     $I->seeResponseCodeIs(200);
     $I->cantSeeResponseContains("\"consumers\":");
     $I->createConsumer();
     $I->createConsumer();
     $I->createConsumer();
     $I->sendGET('api/v1/projects/consumers');
     $I->assertConsumers();
     $I->sendPOST('api/v1/projects/users', ['user_id' => $second_user->_id, 'role' => 'manager', 'scope' => ['tables_view', 'tables_update']]);
     $I->loginUser($second_user);
     $I->sendGET('api/v1/projects/consumers');
     $I->seeResponseCodeIs(403);
     $I->loginUser($user);
     $I->sendPUT('api/v1/projects/users/', ['user_id' => $second_user->_id, 'role' => 'manager', 'scope' => ['tables_view', 'tables_update', 'consumers_get']]);
     $I->loginUser($second_user);
     $I->sendGET('api/v1/projects/consumers');
     $I->assertConsumers();
 }