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={})
|
||||
response = Excon::Response.new
|
||||
response.status = 200
|
||||
response.body = {
|
||||
'volume' => {
|
||||
'id' => Fog::Mock.random_numbers(3).to_i,
|
||||
'displayName' => name,
|
||||
'displayDescription' => description,
|
||||
'size' => size,
|
||||
'status' => 'creating',
|
||||
'snapshotId' => options['snapshot_id'] || "",
|
||||
'volumeType' => nil,
|
||||
'availabilityZone' => 'nova',
|
||||
'createdAt' => Time.now.to_s,
|
||||
'metadata' => options['metadata'] || {},
|
||||
'attachments' => [{}]
|
||||
}
|
||||
data = {
|
||||
'id' => Fog::Mock.random_numbers(3).to_i,
|
||||
'displayName' => name,
|
||||
'displayDescription' => description,
|
||||
'size' => size,
|
||||
'status' => 'creating',
|
||||
'snapshotId' => options['snapshot_id'] || "",
|
||||
'volumeType' => nil,
|
||||
'availabilityZone' => 'nova',
|
||||
'createdAt' => Time.now.to_s,
|
||||
'metadata' => options['metadata'] || {},
|
||||
'attachments' => [{}]
|
||||
}
|
||||
self.data[:volumes][data['id']] = data
|
||||
response.body = { 'volume' => data }
|
||||
response
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,7 +23,8 @@ module Fog
|
|||
|
||||
def delete_volume(volume_id)
|
||||
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
|
||||
else
|
||||
raise Fog::BlockStorage::HP::NotFound
|
||||
|
|
Loading…
Add table
Reference in a new issue