Skip to content

Commit 0ec93f0

Browse files
committed
Network service unit test
1 parent 6aa1859 commit 0ec93f0

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

src/Networking/v2/Models/Quota.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php declare(strict_types = 1);
1+
<?php declare(strict_types=1);
22

33
namespace OpenStack\Networking\v2\Models;
44

tests/unit/Networking/v2/ServiceTest.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
use OpenStack\Networking\v2\Api;
66
use OpenStack\Networking\v2\Models\Network;
77
use OpenStack\Networking\v2\Models\Port;
8+
use OpenStack\Networking\v2\Models\Quota;
89
use OpenStack\Networking\v2\Models\Subnet;
910
use OpenStack\Networking\v2\Service;
1011
use OpenStack\Test\TestCase;
1112
use Prophecy\Argument;
1213

1314
class ServiceTest extends TestCase
1415
{
16+
/** @var Service */
1517
private $service;
1618

1719
public function setUp()
@@ -265,4 +267,39 @@ public function test_it_lists_ports()
265267
$this->assertInstanceOf(Port::class, $port);
266268
}
267269
}
270+
271+
public function test_it_list_quotas()
272+
{
273+
$this->client
274+
->request('GET', 'v2.0/quotas', ['headers' => []])
275+
->shouldBeCalled()
276+
->willReturn($this->getFixture('quotas-get'));
277+
278+
foreach ($this->service->listQuotas() as $quota) {
279+
$this->assertInstanceOf(Quota::class, $quota);
280+
}
281+
}
282+
283+
public function test_it_gets_quotas()
284+
{
285+
$this->client
286+
->request('GET', 'v2.0/quotas/fake_tenant_id', ['headers' => []])
287+
->shouldBeCalled()
288+
->willReturn($this->getFixture('quota-get'));
289+
290+
$quota = $this->service->getQuota('fake_tenant_id');
291+
$quota->retrieve();
292+
293+
$this->assertInstanceOf(Quota::class, $quota);
294+
}
295+
296+
public function test_it_gets_default_quotas()
297+
{
298+
$this->client
299+
->request('GET', 'v2.0/quotas/fake_tenant_id/default', ['headers' => []])
300+
->shouldBeCalled()
301+
->willReturn($this->getFixture('quota-get'));
302+
303+
$this->service->getDefaultQuota('fake_tenant_id');
304+
}
268305
}

0 commit comments

Comments
 (0)