1
0
Fork 0
mirror of synced 2024-06-26 10:10:57 +12:00

Updated server tests

This commit is contained in:
Eldad Fux 2020-01-12 13:47:08 +02:00
parent f77aa39ff7
commit 3686171d6e
4 changed files with 18 additions and 46 deletions

View file

@ -11,9 +11,8 @@ trait SideServer
public function getHeaders():array
{
return [
'x-appwrite-key' => $this->getProject()
'x-appwrite-key' => $this->getProject()['apiKey']
];
}
}

View file

@ -9,22 +9,7 @@ use Tests\E2E\Scopes\SideServer;
class AvatarsCustomServerTest extends Scope
{
use AvatarsBase;
use ProjectCustom;
use SideServer;
public function testGetCreditCard():array
{
/**
* Test for FAILURE
*/
$response = $this->client->call(Client::METHOD_GET, '/avatars/credit-cards/visa', [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$uid'],
'X-appwrite-key' => $this->getProject()['apiKey'],
]);
$this->assertEquals(401, $response['headers']['status-code']);
return [];
}
}

View file

@ -11,11 +11,12 @@ trait LocaleBase
/**
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_GET, '/locale', [
$response = $this->client->call(Client::METHOD_GET, '/locale', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$uid'],
]);
], $this->getHeaders()));
$this->assertEquals($response['headers']['status-code'], 200);
$this->assertArrayHasKey('ip', $response['body']);
$this->assertArrayHasKey('countryCode', $response['body']);
$this->assertArrayHasKey('country', $response['body']);
@ -27,7 +28,7 @@ trait LocaleBase
/**
* Test for FAILURE
*/
return [];
}
@ -36,10 +37,10 @@ trait LocaleBase
/**
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_GET, '/locale/countries', [
$response = $this->client->call(Client::METHOD_GET, '/locale/countries', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$uid'],
]);
], $this->getHeaders()));
$this->assertEquals($response['headers']['status-code'], 200);
$this->assertIsArray($response['body']);
@ -71,10 +72,10 @@ trait LocaleBase
/**
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_GET, '/locale/countries/eu', [
$response = $this->client->call(Client::METHOD_GET, '/locale/countries/eu', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$uid'],
]);
], $this->getHeaders()));
$this->assertEquals($response['headers']['status-code'], 200);
$this->assertIsArray($response['body']);
@ -106,10 +107,10 @@ trait LocaleBase
/**
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_GET, '/locale/countries/phones', [
$response = $this->client->call(Client::METHOD_GET, '/locale/countries/phones', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$uid'],
]);
], $this->getHeaders()));
$this->assertEquals($response['headers']['status-code'], 200);
$this->assertIsArray($response['body']);
@ -129,10 +130,10 @@ trait LocaleBase
/**
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_GET, '/locale/continents', [
$response = $this->client->call(Client::METHOD_GET, '/locale/continents', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$uid'],
]);
], $this->getHeaders()));
$this->assertEquals($response['headers']['status-code'], 200);
$this->assertIsArray($response['body']);
@ -164,10 +165,10 @@ trait LocaleBase
/**
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_GET, '/locale/currencies', [
$response = $this->client->call(Client::METHOD_GET, '/locale/currencies', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$uid'],
]);
], $this->getHeaders()));
$this->assertEquals($response['headers']['status-code'], 200);
$this->assertIsArray($response['body']);

View file

@ -9,22 +9,9 @@ use Tests\E2E\Scopes\SideServer;
class LocaleCustomServerTest extends Scope
{
use LocaleBase;
use ProjectCustom;
use SideServer;
public function testCreateLocale():array
{
/**
* Test for FAILURE
*/
$response = $this->client->call(Client::METHOD_GET, '/avatars/credit-cards/visa', [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$uid'],
'X-appwrite-key' => $this->getProject()['apiKey'],
]);
$this->assertEquals(401, $response['headers']['status-code']);
return [];
}
///$this->getHeaders()
}