Exemplo n.º 1
0
 /**
  *
  */
 public function testDropWorkspace()
 {
     $result = $this->client->getCredentials();
     $workspaceId = $result["workspaceId"];
     $storageApiClient = new \Keboola\StorageApi\Client(["token" => PROVISIONING_API_TOKEN]);
     $storageApiClient->apiDelete("storage/workspaces/{$workspaceId}");
     $result = $this->client->getCredentials();
     $this->assertNotEquals($result["workspaceId"], $workspaceId);
 }
 public function testStorageBackendShouldNotBeRemovedIfThereAreBuckets()
 {
     $name = 'My org';
     $organization = $this->client->createOrganization($this->testMaintainerId, ['name' => $name]);
     $project = $this->client->createProject($organization['id'], ['name' => 'My test']);
     $token = $this->client->createProjectStorageToken($project['id'], ['description' => 'test', 'expiresIn' => 60, 'canManageBuckets' => true]);
     $sapiClient = new \Keboola\StorageApi\Client(['url' => getenv('KBC_MANAGE_API_URL'), 'token' => $token['token']]);
     $sapiClient->createBucket('test', 'in');
     try {
         $this->client->removeProjectStorageBackend($project['id'], reset($project['backends'])['id']);
         $this->fail('Backend should not be removed');
     } catch (ClientException $e) {
         $this->assertEquals(400, $e->getCode());
         $this->assertEquals('bucketsExists', $e->getStringCode());
     }
 }
Exemplo n.º 3
0
 public function testMetaQueryTransformation()
 {
     $sapiClient = new \Keboola\StorageApi\Client(array("token" => PROVISIONING_API_TOKEN));
     $csv = new \Keboola\Csv\CsvFile(ROOT_PATH . "/tests/data/table.csv");
     $sapiClient->createBucket("redshift", \Keboola\StorageApi\Client::STAGE_IN, "provisioning test", "redshift");
     $sapiClient->createBucket("redshift", \Keboola\StorageApi\Client::STAGE_OUT, "provisioning test", "redshift");
     $sapiClient->createTable("in.c-redshift", "test", $csv);
     $sapiClient->createTable("out.c-redshift", "test", $csv);
     $result = $this->client->getCredentials();
     $conn = $this->connect($result);
     $result = $conn->fetchAll("SELECT * FROM SVV_TABLE_INFO;");
     $this->assertGreaterThan(0, count($result));
     $conn->close();
 }