-
-
Notifications
You must be signed in to change notification settings - Fork 130
/
quota_tests.rb
36 lines (31 loc) · 1.03 KB
/
quota_tests.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require 'test_helper'
describe "Fog::Volume[:openstack] | quota requests" do
before do
@volume = Fog::Volume[:openstack]
@tenant_id = Fog::Compute[:openstack].list_tenants.body['tenants'].first['id']
@quota_set_format = {
'volumes' => Fog::Nullable::Integer,
'gigabytes' => Fog::Nullable::Integer,
'snapshots' => Fog::Nullable::Integer,
'id' => String
}
@quota = @volume.get_quota(@tenant_id).body['quota_set']
end
describe "success" do
it "#get_quota_defaults" do
@volume.get_quota_defaults(@tenant_id).body.
must_match_schema('quota_set' => @quota_set_format)
end
it "#get_quota" do
@quota.must_match_schema(@quota_set_format)
end
it "updates quota" do
@new_values = @quota.merge(
'volumes' => @quota['volumes'] / 2,
'snapshots' => @quota['snapshots'] / 2
)
@volume.update_quota(@tenant_id, @new_values.clone)
@volume.get_quota(@tenant_id).body['quota_set'].must_match_schema @new_values
end
end
end