public function testDeletedProjectsErrors() { $organization = $this->initTestOrganization(); $project = $this->initTestProject($organization['id']); $this->client->deleteProject($project['id']); $this->client->deleteOrganization($organization['id']); // deleted organization try { $this->client->listDeletedProjects(array('organizationId' => $organization['id'])); $this->fail('List deleted projects of deleted organization should produce error'); } catch (ClientException $e) { $this->assertEquals(400, $e->getCode()); } // permission validation $client = new \Keboola\ManageApi\Client(['token' => getenv('KBC_TEST_ADMIN_TOKEN'), 'url' => getenv('KBC_MANAGE_API_URL')]); try { $client->listDeletedProjects(); $this->fail('List deleted projects with non super admint oken should produce error'); } catch (ClientException $e) { $this->assertEquals(403, $e->getCode()); } try { $client->undeleteProject($project['id']); $this->fail('Undelete projects with non super admint oken should produce error'); } catch (ClientException $e) { $this->assertEquals(403, $e->getCode()); } }