public function testProjectUpdatePermissions() { $organization = $this->client->createOrganization($this->testMaintainerId, ['name' => 'My org']); $project = $this->client->createProject($organization['id'], ['name' => 'My test']); $this->client->addUserToProject($project['id'], ['email' => getenv('KBC_TEST_ADMIN_EMAIL')]); $client = new \Keboola\ManageApi\Client(['token' => getenv('KBC_TEST_ADMIN_TOKEN'), 'url' => getenv('KBC_MANAGE_API_URL'), 'backoffMaxTries' => 1]); // update $newName = 'new name'; $project = $client->updateProject($project['id'], ['name' => $newName]); $this->assertEquals($newName, $project['name']); // change type should not be allowd try { $client->updateProject($project['id'], ['type' => 'production']); $this->fail('change type should not be allowed'); } catch (ClientException $e) { $this->assertEquals(403, $e->getCode()); } // change expiration should not be allowed try { $client->updateProject($project['id'], ['expirationDays' => 23423]); $this->fail('change expiration should not be allowed'); } catch (ClientException $e) { $this->assertEquals(403, $e->getCode()); } // change monthly fee should not be allowed try { $client->updateProject($project['id'], ['billedMonthlyPrice' => 23423]); $this->fail('change billedMonthlyPrice should not be allowed'); } catch (ClientException $e) { $this->assertEquals(403, $e->getCode()); } }