mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Fix mock for tests.
This commit is contained in:
parent
5d84a98fcf
commit
55b0f8ea35
2 changed files with 16 additions and 15 deletions
|
@ -56,21 +56,21 @@ module Fog
|
||||||
def create_volume(name, description, size, options={})
|
def create_volume(name, description, size, options={})
|
||||||
response = Excon::Response.new
|
response = Excon::Response.new
|
||||||
response.status = 200
|
response.status = 200
|
||||||
response.body = {
|
data = {
|
||||||
'volume' => {
|
'id' => Fog::Mock.random_numbers(3).to_i,
|
||||||
'id' => Fog::Mock.random_numbers(3).to_i,
|
'displayName' => name,
|
||||||
'displayName' => name,
|
'displayDescription' => description,
|
||||||
'displayDescription' => description,
|
'size' => size,
|
||||||
'size' => size,
|
'status' => 'creating',
|
||||||
'status' => 'creating',
|
'snapshotId' => options['snapshot_id'] || "",
|
||||||
'snapshotId' => options['snapshot_id'] || "",
|
'volumeType' => nil,
|
||||||
'volumeType' => nil,
|
'availabilityZone' => 'nova',
|
||||||
'availabilityZone' => 'nova',
|
'createdAt' => Time.now.to_s,
|
||||||
'createdAt' => Time.now.to_s,
|
'metadata' => options['metadata'] || {},
|
||||||
'metadata' => options['metadata'] || {},
|
'attachments' => [{}]
|
||||||
'attachments' => [{}]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
self.data[:volumes][data['id']] = data
|
||||||
|
response.body = { 'volume' => data }
|
||||||
response
|
response
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,7 +23,8 @@ module Fog
|
||||||
|
|
||||||
def delete_volume(volume_id)
|
def delete_volume(volume_id)
|
||||||
response = Excon::Response.new
|
response = Excon::Response.new
|
||||||
if volume = self.data[:volumes][volume_id]
|
if self.data[:volumes][volume_id]
|
||||||
|
self.data[:volumes].delete(volume_id)
|
||||||
response.status = 202
|
response.status = 202
|
||||||
else
|
else
|
||||||
raise Fog::BlockStorage::HP::NotFound
|
raise Fog::BlockStorage::HP::NotFound
|
||||||
|
|
Loading…
Add table
Reference in a new issue