@@ -26,9 +26,6 @@ public function setUp()
26
26
$ this ->server ->id = 'serverId ' ;
27
27
}
28
28
29
- /**
30
- * @expectedException \RuntimeException
31
- */
32
29
public function test_it_creates ()
33
30
{
34
31
$ opts = [
@@ -45,12 +42,36 @@ public function test_it_creates()
45
42
46
43
$ this ->setupMock ('POST ' , 'servers ' , $ expectedJson , [], 'server-post ' );
47
44
$ this ->assertInstanceOf (Server::class, $ this ->server ->create ($ opts ));
45
+ }
48
46
47
+ public function test_it_creates_with_boot_from_volume ()
48
+ {
49
49
$ opts = [
50
50
'name ' => 'foo ' ,
51
51
'flavorId ' => 'baz ' ,
52
+ 'blockDeviceMapping ' => [['uuid ' => 'aaaa-ddddd-bbbb-ccccc ' ]]
52
53
];
53
- $ this ->server ->create ($ opts );
54
+
55
+ $ expectedJson = ['server ' => [
56
+ 'name ' => $ opts ['name ' ],
57
+ 'flavorRef ' => $ opts ['flavorId ' ],
58
+ 'block_device_mapping_v2 ' => $ opts ['blockDeviceMapping ' ]
59
+ ]];
60
+
61
+ $ this ->setupMock ('POST ' , 'servers ' , $ expectedJson , [], 'server-post ' );
62
+ $ this ->assertInstanceOf (Server::class, $ this ->server ->create ($ opts ));
63
+ }
64
+
65
+ /**
66
+ * @expectedException \RuntimeException
67
+ * @expectedExceptionMessage imageId or blockDeviceMapping.uuid must be set.
68
+ */
69
+ public function test_it_requires_image_id_or_volume_id_to_create_servers ()
70
+ {
71
+ $ this ->server ->create ([
72
+ 'name ' => 'some-server-name ' ,
73
+ 'flavorId ' => 'apple '
74
+ ]);
54
75
}
55
76
56
77
public function test_it_updates ()
0 commit comments