From 812ea8015c5888b53e37a8390192ab2773c577a1 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 29 Oct 2020 23:08:20 +0200 Subject: [PATCH 1/2] Fixed templates --- app/controllers/general.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 0f283d3f5e..805aa32ab6 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -413,7 +413,7 @@ App::get('/robots.txt') ->label('scope', 'public') ->label('docs', false) ->action(function ($response) { - $template = new View(__DIR__.'/views/general/robots.phtml'); + $template = new View(__DIR__.'/../views/general/robots.phtml'); $response->text($template->render(false)); }, ['response']); @@ -422,7 +422,7 @@ App::get('/humans.txt') ->label('scope', 'public') ->label('docs', false) ->action(function ($response) { - $template = new View(__DIR__.'/views/general/humans.phtml'); + $template = new View(__DIR__.'/../views/general/humans.phtml'); $response->text($template->render(false)); }, ['response']); From 7a8c9f6d0d7cb33d688206b31492fb5994884697 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 29 Oct 2020 23:15:45 +0200 Subject: [PATCH 2/2] Added missing tests --- tests/e2e/General/HTTPTest.php | 45 ++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/e2e/General/HTTPTest.php b/tests/e2e/General/HTTPTest.php index e01b35952e..5282bd7a8f 100644 --- a/tests/e2e/General/HTTPTest.php +++ b/tests/e2e/General/HTTPTest.php @@ -47,4 +47,49 @@ class HTTPTest extends Scope $this->assertEquals(404, $response['body']['code']); $this->assertEquals('dev', $response['body']['version']); } + + public function testManifest() + { + /** + * Test for SUCCESS + */ + $response = $this->client->call(Client::METHOD_GET, '/manifest.json', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + ]), []); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals('Appwrite', $response['body']['name']); + $this->assertEquals('Appwrite', $response['body']['short_name']); + $this->assertEquals('.', $response['body']['start_url']); + $this->assertEquals('.', $response['body']['start_url']); + $this->assertEquals('https://appwrite.io/', $response['body']['url']); + $this->assertEquals('standalone', $response['body']['display']); + } + + public function testHumans() + { + /** + * Test for SUCCESS + */ + $response = $this->client->call(Client::METHOD_GET, '/humans.txt', array_merge([ + 'origin' => 'http://localhost', + ]), []); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString('# humanstxt.org/', $response['body']); + } + + public function testRobots() + { + /** + * Test for SUCCESS + */ + $response = $this->client->call(Client::METHOD_GET, '/robots.txt', array_merge([ + 'origin' => 'http://localhost', + ]), []); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString('# robotstxt.org/', $response['body']); + } } \ No newline at end of file