public function delete(ApiTester $I)
 {
     $I->wantTo('delete 1 contact in Joomla using SOAP');
     $I->amHttpAuthenticated('admin', 'admin');
     $I->sendSoapRequest('delete', ['id' => $this->id]);
     $I->seeSoapResponseIncludes("<result>true</result>");
     $I->sendSoapRequest('readItem', ['id' => $this->id]);
     $I->dontSeeSoapResponseIncludes("<name>{$this->name}</name>");
 }
예제 #2
0
 public function invalidTime(ApiTester $I)
 {
     $I->am('an invalid device');
     $I->wantTo('verify the endpoint returns validation failures - invalid time');
     //Send a bad code to the endpoint
     $I->haveHttpHeader('Content-Type', 'application/json');
     $I->haveHttpHeader('Accept', 'application/json');
     $I->sendPOST('/acs', ['device' => 'main-door', 'tag' => 'ABCDEF123456', 'message' => 'boot', 'service' => 'entry', 'time' => 'abcdefgh']);
     $I->canSeeResponseCodeIs(422);
 }
 /**
  * @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 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']));
 }
예제 #5
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']));
 }
예제 #6
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]);
 }
 public function successfullEnd(ApiTester $I)
 {
     $I->am('a valid user');
     $I->wantTo('verify the endpoint returns a success response and creates the proper records');
     $user = $I->getActiveKeyholderMember();
     $keyFob = $I->getMemberKeyFob($user->id);
     //Send a bad code to the endpoint
     $I->sendPOST('/access-control/device', ['data' => $keyFob->key_id . '|welder|start']);
     //The device endpoint always returns 200
     $I->canSeeResponseCodeIs(200);
     //Make sure a success is returned and a session started
     $I->canSeeResponseContainsJson(['valid' => '1']);
     $I->seeInDatabase('equipment_log', ['user_id' => $user->id, 'device' => 'welder', 'active' => 1]);
     $I->sendPOST('/access-control/device', ['data' => $keyFob->key_id . '|welder|end']);
     $I->canSeeResponseCodeIs(200);
     $I->dontSeeHttpHeader('Set-Cookie');
     $I->dontSeeHttpHeader('Built-By');
     $I->canSeeResponseContainsJson(['valid' => '1']);
     //Make sure our database record is not active
     $I->seeInDatabase('equipment_log', ['user_id' => $user->id, 'device' => 'welder', 'active' => 0]);
     //And make sure there is no other active record
     $I->cantSeeInDatabase('equipment_log', ['user_id' => $user->id, 'device' => 'welder', 'active' => 1]);
 }
예제 #8
0
<?php

$scenario->group('rels');
$I = new ApiTester($scenario);
$I->wantTo('load the initial rels');
$I->sendGET('/rels');
$I->grabDataFromResponseByJsonPath('$');
$I->seeResponseContainsJson(['loadList' => '/list/elements', 'addToList' => '/list/elements', 'removeFromList' => '/list/elements']);
예제 #9
0
<?php

$I = new ApiTester($scenario);
$I->wantTo('Insert items and checkout');
/**
 * @var array $item1
 * @var array $item2
 * @var int   $order
 */
require "_AddItems.php";
$I->amGoingTo('checkout');
$I->sendPATCH('cart');
$I->seeCodeAndJson(200, ['id' => $order, 'total' => floatify($item1['final_price'] + $item2['final_price'])]);
$I->amGoingTo('verify the order was really ~closed~');
$I->sendGET('cart');
$I->assertEquals(sizeof(json_decode($I->grabResponse())->items), 0, 'verify the cart is now empty');
<?php

$I = new ApiTester($scenario);
$I->wantTo('perform actions and see result');
<?php

$I = new ApiTester($scenario);
$I->wantTo('adicionar um novo pedido');
$I->amHttpAuthenticated('phptesting', '123');
$I->sendPOST('/pedido', ['produtoid' => 1, 'produtonome' => 'Firefox', 'produtoestoque' => 10, 'produtovalor' => 49.9]);
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContainsJson(['status' => 'sucesso', 'message' => 'Sucesso']);
예제 #12
0
<?php

$I = new ApiTester($scenario);
$I->wantTo('Get friends list');
$I->haveHttpHeader('Content-Type', 'application/json');
$I->sendGET('/users/14/friends', array());
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
예제 #13
0
<?php

$I = new ApiTester($scenario);
$I->wantTo('Get user with not exists id');
$I->sendGET('users/500000000');
$I->seeResponseCodeIs(404);
$I->seeResponseIsJson();
$I->haveHttpHeader('Content-Type', 'application/json');
예제 #14
0
<?php

$I = new ApiTester($scenario);
$I->wantTo('Check for hot tips');
//$I->amHttpAuthenticated('service_user', '123456');
////$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
$I->sendGet('http://api.invendium-dev.com/?source=');
//$I->seeResponseCodeIs(200);
//$I->seeResponseIsJson();
//$I->seeResponseContains('odds_rounded');
//$I->seeResponseContains('popularity');
//$I->seeResponseContainsJson(array('sport' => 'Football'));
$tips = $I->grabDataFromResponseByJsonPath('$.tips');
$array = array();
foreach ($tips[0] as $tip) {
    $array[] = $tip['sportname'];
}
$array = array_count_values($array);
foreach ($array as $sportname => $tipsCount) {
    $I->assertGreaterThanOrEqual('10', $tipsCount, "{$sportname} has only {$tipsCount} tips.");
}
예제 #15
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.');
 }
예제 #16
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];
예제 #17
0
<?php

$I = new ApiTester($scenario);
$I->wantTo('Get all non-deleted notes');
$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
$I->sendGET('/notes');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContainsJson([['id' => 8, 'user' => 'Howken', 'project' => 'KulGrej', 'content' => 'rtyrty', 'completed' => 1, 'created' => '2016-01-05 10:28:03', 'deadline' => '2016-01-08 10:28:03'], ['id' => 2, 'user' => 'BluePrint', 'project' => 'Fiskpinne', 'content' => 'qweqwea', 'completed' => 1, 'created' => '2016-01-05 10:28:42', 'deadline' => '2016-01-05 10:28:42'], ['id' => 3, 'user' => 'BluePrint', 'project' => 'KulGrej', 'content' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', 'completed' => 1, 'created' => '2016-01-05 10:28:42', 'deadline' => '2016-01-05 10:28:42'], ['id' => 4, 'user' => 'BluePrint', 'project' => 'Fiskpinne', 'content' => '123123', 'completed' => 0, 'created' => '2016-01-05 10:28:42', 'deadline' => '2016-01-08 10:28:42'], ['id' => 5, 'user' => 'Howken', 'project' => 'Birdie', 'content' => 'jkljkl', 'completed' => 0, 'created' => '2016-01-05 10:28:42', 'deadline' => '2016-01-05 10:28:42'], ['id' => 6, 'user' => 'Howken', 'project' => 'Fiskpinne', 'content' => 'tyutyu', 'completed' => 1, 'created' => '2016-01-05 10:28:42', 'deadline' => '2016-01-07 10:28:42'], ['id' => 7, 'user' => 'Howken', 'project' => 'KulGrej', 'content' => 'bnmbnm', 'completed' => 0, 'created' => '2016-01-05 10:28:42', 'deadline' => '2016-01-05 10:28:42'], ['id' => 1, 'user' => 'BluePrint', 'project' => 'Birdie', 'content' => 'Martin', 'completed' => 0, 'created' => '2016-01-05 10:30:41', 'deadline' => '2016-01-14 10:29:38']]);
예제 #18
0
<?php

//$request_body = 'password android reset account';
$get_url = 'password_android_reset_account';
$response_body = ['articles' => [0 => ['filename' => 'http://35.9.22.229:8080/assets/images/ChangePassword_Androidd.png', 'header' => 'Change Password - Android', 'description' => 'A guide for Android users on changing their password.', 'type' => 'article'], 1 => ['filename' => 'http://35.9.22.229:8080/assets/images/ChangePassword_Apple.png', 'header' => 'Change Password - Apple', 'description' => 'A guide for Apple users on changing their password.', 'type' => 'article'], 2 => ['filename' => 'http://35.9.22.229:8080/assets/images/GMID_Password.png', 'header' => 'Change Password - Desktop', 'description' => 'Change a user\'s Windows Desktop GMID password.', 'type' => 'article'], 3 => ['filename' => 'http://35.9.22.229:8080/assets/images/ChangePassword_Windows8Phone.png', 'header' => 'Change Password - Windows 8 Phone', 'description' => 'A guide to help change the user password on their Windows 8 phone.', 'type' => 'article']]];
$I = new ApiTester($scenario);
$I->wantTo('search for appropraite articles based on given keyword string');
//$I->sendPOST('/help_data/', $request_body);
$I->sendGET('/help_data?search=' . urlencode($get_url));
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContainsJson($response_body);
예제 #19
0
<?php

$response_body = ['tickets' => [0 => ['interaction_id' => 'SD000000001', 'category' => 'Incident', 'issue' => 'My new outlook password wont\'t work', 'status' => 'Submitted', 'description' => 'Every time i open my outlook it prompts me for my password', 'affected_service' => 'Outlook', 'gm_id' => '1Z3456', 'admin_gm_id' => '', 'notify_type' => 'CALLME', 'phase' => 'WIP', 'last_update_date' => '2015-09-21 11:28:54', 'creation_date' => '2015-09-21 11:26:10'], 1 => ['interaction_id' => 'SD000000002', 'category' => 'Incident', 'issue' => 'Broke laptop screen', 'status' => 'Submitted', 'description' => 'Dropped new laptop on pavement, broke the screen', 'affected_service' => 'Work', 'gm_id' => '1Z3456', 'admin_gm_id' => '', 'notify_type' => 'DONTCALL', 'phase' => 'WIP', 'last_update_date' => '2015-09-20 00:00:00', 'creation_date' => '2015-09-22 00:00:00'], 2 => ['interaction_id' => 'SD000000002', 'category' => 'Incident', 'issue' => 'Broke laptop screen', 'status' => 'Submitted', 'description' => 'Dropped new laptop on pavement, broke the screen', 'affected_service' => 'Work', 'gm_id' => '1Z3456', 'admin_gm_id' => '', 'notify_type' => 'DONTCALL', 'phase' => 'WIP', 'last_update_date' => '2015-09-20 00:00:00', 'creation_date' => '2015-09-22 00:00:00'], 3 => ['interaction_id' => '1', 'category' => 'Desktop', 'issue' => 'Wont turn on!', 'status' => 'Submitted', 'description' => 'Yes, I have tried turning it on and off again!', 'affected_service' => 'Computer', 'gm_id' => '1Z3456', 'admin_gm_id' => '', 'notify_type' => 'CALL', 'phase' => 'WIP', 'last_update_date' => '2014-01-01 00:12:45', 'creation_date' => '2014-01-01 00:11:11']]];
$I = new ApiTester($scenario);
$I->wantTo('get personal tickets based on admin gm id');
//$I->haveHttpHeader('Content-Type', 'application/json');
$I->sendGET('/tickets?admin_gm_id=7357');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContainsJson($response_body);
 function obtainAuthCodeGrantRedirectsToLogin(ApiTester $I)
 {
     $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('Be redirected to login page when un authenticated user visits auth code page');
     $I->amOnPage('authorize?client_id=' . $client->id . '&redirect_uri=' . $endpoint->redirect_uri . '&response_type=code&scope=user_read');
     $I->seeInCurrentUrl('login');
 }
예제 #21
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)]);
예제 #22
0
<?php

Yii::$app->redis->executeCommand('FLUSHDB');
use Codeception\Util\Debug;
$model = new \app\models\Message();
$model->author_email = '*****@*****.**';
$model->author_name = 'test';
$model->message = str_repeat('A', 140);
$model->save();
$I = new ApiTester($scenario);
$I->wantTo('Ver a lista de mensagens');
$I->sendGET('messages', []);
$I->seeResponseIsJson();
$I->seeResponseJsonMatchesJsonPath('$[0].author_name');
$I->seeResponseJsonMatchesJsonPath('$[0].author_email');
$I->seeResponseJsonMatchesJsonPath('$[0].message');
$I->seeResponseJsonMatchesJsonPath('$[0].id');
$I->seeResponseJsonMatchesJsonPath('$[0].creation_time');
예제 #23
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]);
예제 #24
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]);
예제 #25
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);
예제 #26
0
<?php

$response_body = ['tickets' => [0 => ['interaction_id' => 'SD000000001', 'category' => 'Incident', 'issue' => 'My new outlook password wont\'t work', 'status' => 'Submitted', 'description' => 'Every time i open my outlook it prompts me for my password', 'affected_service' => 'Outlook', 'gm_id' => '1Z3456', 'admin_gm_id' => '', 'notify_type' => 'CALLME', 'phase' => 'WIP', 'last_update_date' => '2015-09-21 11:28:54', 'creation_date' => '2015-09-21 11:26:10'], 1 => ['interaction_id' => 'SD000000002', 'category' => 'Incident', 'issue' => 'Broke laptop screen', 'status' => 'Submitted', 'description' => 'Dropped new laptop on pavement, broke the screen', 'affected_service' => 'Work', 'gm_id' => '1Z3456', 'admin_gm_id' => '', 'notify_type' => 'DONTCALL', 'phase' => 'WIP', 'last_update_date' => '2015-09-20 00:00:00', 'creation_date' => '2015-09-22 00:00:00'], 2 => ['interaction_id' => 'SD000000002', 'category' => 'Incident', 'issue' => 'Broke laptop screen', 'status' => 'Submitted', 'description' => 'Dropped new laptop on pavement, broke the screen', 'affected_service' => 'Work', 'gm_id' => '1Z3456', 'admin_gm_id' => '', 'notify_type' => 'DONTCALL', 'phase' => 'WIP', 'last_update_date' => '2015-09-20 00:00:00', 'creation_date' => '2015-09-22 00:00:00'], 3 => ['interaction_id' => '1', 'category' => 'Desktop', 'issue' => 'Wont turn on!', 'status' => 'Submitted', 'description' => 'Yes, I have tried turning it on and off again!', 'affected_service' => 'Computer', 'gm_id' => '1Z3456', 'admin_gm_id' => '', 'notify_type' => 'CALL', 'phase' => 'WIP', 'last_update_date' => '2014-01-01 00:12:45', 'creation_date' => '2014-01-01 00:11:11']]];
$I = new ApiTester($scenario);
$I->wantTo('get tickets based on gm id');
//$I->haveHttpHeader('Content-Type', 'application/json');
$I->sendGET('/tickets?gm_id=1Z3456');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContainsJson($response_body);
<?php

$I = new ApiTester($scenario);
$I->wantTo('Test the database/export endpoint via GET');
$I->haveHttpHeader('X-PublicKey', '248512b6a66f365a4e42f10ed0c854844767b8ca8eb0f74589953991e9f233b6');
$I->haveHttpHeader('X-Hash', 'e651e0f6450f89d82ab0a34c1d421097a635897f5e719179e49263ff145e6ed9');
$I->sendGET('database/export');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContainsJson(array('assets' => array(0 => array('AssetID' => '4b67517f4462a', 'GenericAssetID' => '12636', 'UMDNS' => '12636', 'AssetFullName' => 'Dash', 'ManufacturerID' => '4c44276c3c2c0', 'Model' => '4000 ', 'SerialNumber' => 'SD008484463GA', 'InternalIventoryNumber' => '01382928', 'LocationID' => '4b6b4f5120321', 'ResponsiblePers' => NULL, 'AssetStatusID' => '1', 'AssetUtilizationID' => '1', 'PurchaseDate' => NULL, 'InstallationDate' => NULL, 'Lifetime' => '10', 'PurchasePrice' => '131174', 'CurrentValue' => '104939', 'WarrantyContractID' => '1', 'AgentID' => '4c90677ca7db7', 'WarrantyContractExp' => NULL, 'WarrantyContractNotes' => NULL, 'EmployeeID' => '4cb6b8bbb9df6', 'SupplierID' => '4b595a7124c8b', 'DonorID' => '4c9066fc81b53', 'Notes' => NULL, 'Picture' => 'gen_images/12636.jpg', 'lastmodified' => '2010-02-05 01:47:18', 'by_user' => 'demo', 'URL_Manual' => NULL, 'MetrologyDocument' => NULL, 'MetrologyDate' => NULL, 'Metrology' => '0'))));
$I->seeResponseContainsJson(array('location' => array(0 => array('LocationID' => '4b6b4f5120321', 'FacilityID' => '11', 'DeptID' => '2', 'Roomnb' => '', 'Floor' => '', 'Building' => '', 'NotetoTech' => '-'))));
$I->seeResponseContainsJson(array('facilities' => array(0 => array('FacilityID' => '11', 'DistrictID' => '10001', 'FacilityName' => 'Central Hosptial'))));
$I->seeResponseContainsJson(array('facilities' => array(0 => array('FacilityID' => '11', 'DistrictID' => '10001', 'FacilityName' => 'Central Hosptial'))));
$I->seeResponseContainsJson(array('contacttype' => array(0 => array('ContactTypeID' => '1', 'ContactTypeName' => 'Manufacturer'))));
$I->seeResponseContainsJson(array('contact' => array(0 => array('ContactID' => '4ac3718e8d251', 'ContactTypeID' => '3', 'ContactName' => 'Nespecificat', 'ContactPersonName' => NULL, 'ContactTitle' => NULL, 'Address' => NULL, 'City' => NULL, 'PostalCode' => NULL, 'CountryID' => '99999', 'PhoneNumber' => NULL, 'FaxNumber' => NULL, 'Website' => '', 'Services' => NULL))));
$I->seeResponseContainsJson(array('donors' => array(0 => array('DonorID' => '0', 'ContactID' => '4ac3718e8d251'))));
$I->seeResponseContainsJson(array('agents' => array(0 => array('AgentID' => '0', 'ContactID' => '4ac3718e8d251'))));
$I->seeResponseContainsJson(array('suppliers' => array(0 => array('SupplierID' => '4b59581a8bb8f', 'ContactID' => '4b59581a8abf1'))));
$I->seeResponseContainsJson(array('manufactures' => array(0 => array('ManufacturerID' => '4b0be58d2806b', 'ContactID' => '4b0be58d2612c'))));
$I->seeResponseContainsJson(array('consumables' => array(0 => array('ConsumableID' => '1', 'Name' => 'Sensor debit', 'ManufacturerID' => '4c62506a58149', 'PartNumber' => '121', 'PackageQty' => '1', 'SupplierID' => '4c36d8223e3cf', 'UnitPrice' => '1', 'Notes' => '1', 'lastmodified' => '2012-01-17 14:15:11', 'by_user' => 'demo', 'TypeCons' => NULL))));
$I->seeResponseContainsJson(array('consumables_linked' => array(0 => array('Consumable_linkedID' => '1', 'ConsumableID' => '1', 'AssetID' => '4f154ff62df0e', 'AnnualConsumption' => '100', 'Notes' => 'Order 2 month before'))));
$I->seeResponseContainsJson(array('employees' => array(0 => array('EmployeeID' => '0', 'LoginID' => '3', 'FirstName' => 'admin', 'LastName' => 'admin', 'Position' => NULL, 'TechnicianYN' => '1', 'LocationID' => '4b0be83d5d1d7', 'WorkPhone' => NULL, 'HandPhone' => NULL, 'Email' => NULL, 'Fax' => NULL, 'Accesslevel' => ' AND (facilities.FacilityID=12)'))));
$I->seeResponseContainsJson(array('department' => array(3 => array('DeptID' => '4', 'DepartmentDesc' => 'Allergology'))));
$I->seeResponseContainsJson(array('essential_equipment' => array(0 => array('EssentialEquipmentID' => '1', 'FacilityID' => '11', 'GenericAssetID' => '10134', 'MinimalQuantity' => '2', 'Notes' => NULL))));
$I->seeResponseContainsJson(array('assetgenericname' => array(0 => array('GenericAssetID' => '10134', 'GenericAssetCode' => '10134', 'GenericAssetName' => 'Anaesthesia Units', 'AssetCategoryID' => '5', 'GenericPicture' => 'gen_images/10134.jpg'))));
$I->seeResponseContainsJson(array('assetutilization' => array(0 => array('AssetUtilizationID' => '1', 'AssetUtilizationDesc' => 'Normal'))));
$I->seeResponseContainsJson(array('assetstatus' => array(0 => array('AssetStatusID' => '1', 'AssetStatusDesc' => 'Fully functional'))));
$I->seeResponseContainsJson(array('assetcategory' => array(0 => array('AssetCategoryID' => '1', 'AssetCategoryNr' => '1', 'AssetCategoryName' => 'Dental'))));
$I->seeResponseContainsJson(array('intervention' => array(0 => array('IntervID' => '532c5b53aab95', 'Date' => '2014-03-21', 'EmployeeID' => '4d64045c4a525', 'AssetStatusID' => '1', 'AssetID_Visit' => '4b67517f4462a', 'Request_id' => '52fddba460044', 'FaildPart' => 'Cable', 'FailurCategID' => '2', 'FailureCauseID' => '0', 'Interv_desc' => 'Description Intervention', 'Interv_desc_eg' => '', 'Comments' => 'Comments', 'RespEng' => '4c8fcac9f06fa', 'TotalWork' => '0', 'TotalCosts' => '0', 'lastmodified' => '2014-03-21 16:59:22', 'by_user' => 'demo'))));
$I->seeResponseContainsJson(array('request' => array(0 => array('Request_id' => '52fddba460044', 'Request_date' => '2014-02-14', 'Request_desc' => 'Repair', 'Request_desc_eg' => 'Repair', 'AssetID' => '4b67517f4462a', 'Request_st_id' => '1', 'Request_contact_name' => 'Agata Correia', 'Request_note' => 'Notes', 'lastmodified' => '2014-02-14 10:02:53', 'by_user' => 'demo', 'VisiTpID' => '1'))));
$I->seeResponseContainsJson(array('request_st' => array(0 => array('Request_st_id' => '1', 'Request_st_desc' => 'Open'))));
예제 #28
0
<?php

$request_body = ['gm_id' => '1Z3967', 'token' => 'Works for me'];
$response_body = ['work_phone' => '517-555-4356'];
$I = new ApiTester($scenario);
$I->wantTo('update device token for a user');
$I->haveHttpHeader('Content-Type', 'application/json');
$I->sendPOST('/device_token.php', $request_body);
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContainsJson($response_body);
<?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
<?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');