Skip to content

Commit

Permalink
test other methods
Browse files Browse the repository at this point in the history
  • Loading branch information
nadar committed Oct 14, 2020
1 parent c4e9700 commit 8983345
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/models/ProxyBuild.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
* @property string $config
* @property integer $is_complet
* @property integer $expiration_time
* @property array $arrayConfig
*
* @property ProxyMachine $proxyMachine
* @property array $arrayConfig
*
* @author Basil Suter <basil@nadar.io>
* @since 1.0.0
Expand Down
27 changes: 27 additions & 0 deletions tests/admin/apis/ProxyControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,31 @@ public function testActionFileProvide()
$this->expectException(HeadersAlreadySentException::class);
$ctrl->actionFileProvider('machine', 'token', 1);
}

public function testActionIndex()
{
$ctrl = new ProxyController('proxy', $this->app->getModule('admin'));
$response = $ctrl->actionIndex('machine', sha1('machine'));

$this->assertArrayHasKey('providerUrl', $response);
$this->assertArrayHasKey('requestCloseUrl', $response);
$this->assertArrayHasKey('fileProviderUrl', $response);
$this->assertArrayHasKey('imageProviderUrl', $response);
$this->assertArrayHasKey('buildToken', $response);
$this->assertArrayHasKey('config', $response);

$this->assertArrayHasKey('rowsPerRequest', $response['config']);
$this->assertArrayHasKey('tables', $response['config']);
$this->assertArrayHasKey('storageFilesCount', $response['config']);
}

public function testActionDataProvider()
{
$ctrl = new ProxyController('proxy', $this->app->getModule('admin'));
$create = $ctrl->actionIndex('machine', sha1('machine'));

$response = $ctrl->actionDataProvider('machine', sha1($create['buildToken']), 'admin_storage_image', 10);

$this->assertEmpty($response);
}
}

0 comments on commit 8983345

Please sign in to comment.