Updated server tests
This commit is contained in:
parent
f77aa39ff7
commit
3686171d6e
|
@ -11,9 +11,8 @@ trait SideServer
|
||||||
|
|
||||||
public function getHeaders():array
|
public function getHeaders():array
|
||||||
{
|
{
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'x-appwrite-key' => $this->getProject()
|
'x-appwrite-key' => $this->getProject()['apiKey']
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,22 +9,7 @@ use Tests\E2E\Scopes\SideServer;
|
||||||
|
|
||||||
class AvatarsCustomServerTest extends Scope
|
class AvatarsCustomServerTest extends Scope
|
||||||
{
|
{
|
||||||
|
use AvatarsBase;
|
||||||
use ProjectCustom;
|
use ProjectCustom;
|
||||||
use SideServer;
|
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 [];
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -11,11 +11,12 @@ trait LocaleBase
|
||||||
/**
|
/**
|
||||||
* Test for SUCCESS
|
* 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',
|
'content-type' => 'application/json',
|
||||||
'x-appwrite-project' => $this->getProject()['$uid'],
|
'x-appwrite-project' => $this->getProject()['$uid'],
|
||||||
]);
|
], $this->getHeaders()));
|
||||||
|
|
||||||
|
$this->assertEquals($response['headers']['status-code'], 200);
|
||||||
$this->assertArrayHasKey('ip', $response['body']);
|
$this->assertArrayHasKey('ip', $response['body']);
|
||||||
$this->assertArrayHasKey('countryCode', $response['body']);
|
$this->assertArrayHasKey('countryCode', $response['body']);
|
||||||
$this->assertArrayHasKey('country', $response['body']);
|
$this->assertArrayHasKey('country', $response['body']);
|
||||||
|
@ -27,7 +28,7 @@ trait LocaleBase
|
||||||
/**
|
/**
|
||||||
* Test for FAILURE
|
* Test for FAILURE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,10 +37,10 @@ trait LocaleBase
|
||||||
/**
|
/**
|
||||||
* Test for SUCCESS
|
* 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',
|
'content-type' => 'application/json',
|
||||||
'x-appwrite-project' => $this->getProject()['$uid'],
|
'x-appwrite-project' => $this->getProject()['$uid'],
|
||||||
]);
|
], $this->getHeaders()));
|
||||||
|
|
||||||
$this->assertEquals($response['headers']['status-code'], 200);
|
$this->assertEquals($response['headers']['status-code'], 200);
|
||||||
$this->assertIsArray($response['body']);
|
$this->assertIsArray($response['body']);
|
||||||
|
@ -71,10 +72,10 @@ trait LocaleBase
|
||||||
/**
|
/**
|
||||||
* Test for SUCCESS
|
* 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',
|
'content-type' => 'application/json',
|
||||||
'x-appwrite-project' => $this->getProject()['$uid'],
|
'x-appwrite-project' => $this->getProject()['$uid'],
|
||||||
]);
|
], $this->getHeaders()));
|
||||||
|
|
||||||
$this->assertEquals($response['headers']['status-code'], 200);
|
$this->assertEquals($response['headers']['status-code'], 200);
|
||||||
$this->assertIsArray($response['body']);
|
$this->assertIsArray($response['body']);
|
||||||
|
@ -106,10 +107,10 @@ trait LocaleBase
|
||||||
/**
|
/**
|
||||||
* Test for SUCCESS
|
* 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',
|
'content-type' => 'application/json',
|
||||||
'x-appwrite-project' => $this->getProject()['$uid'],
|
'x-appwrite-project' => $this->getProject()['$uid'],
|
||||||
]);
|
], $this->getHeaders()));
|
||||||
|
|
||||||
$this->assertEquals($response['headers']['status-code'], 200);
|
$this->assertEquals($response['headers']['status-code'], 200);
|
||||||
$this->assertIsArray($response['body']);
|
$this->assertIsArray($response['body']);
|
||||||
|
@ -129,10 +130,10 @@ trait LocaleBase
|
||||||
/**
|
/**
|
||||||
* Test for SUCCESS
|
* 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',
|
'content-type' => 'application/json',
|
||||||
'x-appwrite-project' => $this->getProject()['$uid'],
|
'x-appwrite-project' => $this->getProject()['$uid'],
|
||||||
]);
|
], $this->getHeaders()));
|
||||||
|
|
||||||
$this->assertEquals($response['headers']['status-code'], 200);
|
$this->assertEquals($response['headers']['status-code'], 200);
|
||||||
$this->assertIsArray($response['body']);
|
$this->assertIsArray($response['body']);
|
||||||
|
@ -164,10 +165,10 @@ trait LocaleBase
|
||||||
/**
|
/**
|
||||||
* Test for SUCCESS
|
* 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',
|
'content-type' => 'application/json',
|
||||||
'x-appwrite-project' => $this->getProject()['$uid'],
|
'x-appwrite-project' => $this->getProject()['$uid'],
|
||||||
]);
|
], $this->getHeaders()));
|
||||||
|
|
||||||
$this->assertEquals($response['headers']['status-code'], 200);
|
$this->assertEquals($response['headers']['status-code'], 200);
|
||||||
$this->assertIsArray($response['body']);
|
$this->assertIsArray($response['body']);
|
||||||
|
|
|
@ -9,22 +9,9 @@ use Tests\E2E\Scopes\SideServer;
|
||||||
|
|
||||||
class LocaleCustomServerTest extends Scope
|
class LocaleCustomServerTest extends Scope
|
||||||
{
|
{
|
||||||
|
use LocaleBase;
|
||||||
use ProjectCustom;
|
use ProjectCustom;
|
||||||
use SideServer;
|
use SideServer;
|
||||||
|
|
||||||
public function testCreateLocale():array
|
///$this->getHeaders()
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 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 [];
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue