Skip to content

Commit 35e476f

Browse files
committed
Unit test for server action: start/stop
1 parent 03aba2e commit 35e476f

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

tests/unit/Compute/v2/Models/ServerTest.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use OpenStack\Compute\v2\Models\Server;
1010
use OpenStack\Test\TestCase;
1111
use OpenStack\Networking\v2\Extensions\SecurityGroups\Models\SecurityGroup;
12-
use Prophecy\Argument;
1312

1413
class ServerTest extends TestCase
1514
{
@@ -138,6 +137,24 @@ public function test_it_rebuilds()
138137
$this->assertEquals($userOptions['name'], $this->server->name);
139138
}
140139

140+
public function test_it_starts()
141+
{
142+
$expectedJson = ['os-start' => null];
143+
144+
$this->setupMock('POST', 'servers/serverId/action', $expectedJson, [], new Response(202));
145+
146+
$this->assertNull($this->server->start());
147+
}
148+
149+
public function test_it_stops()
150+
{
151+
$expectedJson = ['os-stop' => null];
152+
153+
$this->setupMock('POST', 'servers/serverId/action', $expectedJson, [], new Response(202));
154+
155+
$this->assertNull($this->server->stop());
156+
}
157+
141158
public function test_it_resizes()
142159
{
143160
$expectedJson = ['resize' => ['flavorRef' => 'flavorId']];

0 commit comments

Comments
 (0)