~ubuntu-branches/ubuntu/saucy/nova/saucy-proposed

« back to all changes in this revision

Viewing changes to nova/tests/api/openstack/compute/contrib/test_quotas.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Adam Gandelman
  • Date: 2013-02-22 09:27:29 UTC
  • mfrom: (1.1.68)
  • Revision ID: package-import@ubuntu.com-20130222092729-nn3gt8rf97uvts77
Tags: 2013.1.g3-0ubuntu1
[ Chuck Short ]
* New usptream release. 
* debian/patches/debian/patches/fix-ubuntu-tests.patch: Refreshed.
* debian/nova-baremetal.logrotate: Fix logfile path.
* debian/control, debian/nova-spiceproxy.{install, logrotate, upstart}:
  Add spice html5 proxy support.
* debian/nova-novncproxy.upstart: Start on runlevel [2345]
* debian/rules: Call testr directly since run_tests.sh -N gives weird return
  value when tests pass.
* debian/pyddist-overrides: Add websockify.
* debian/nova-common.postinst: Removed config file conversion, since
  the option is no longer available. (LP: #1110567)
* debian/control: Add python-pyasn1 as a dependency.
* debian/control: Add python-oslo-config as a dependency.
* debian/control: Suggest sysfsutils, sg3-utils, multipath-tools for fibre
  channel support.

[ Adam Gandelman ]
* debian/control: Fix typo (websocikfy -> websockify).

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
            'injected_file_content_bytes': 10240,
52
52
            'security_groups': 10,
53
53
            'security_group_rules': 20,
54
 
            'key_pairs': 100,
55
 
            }
 
54
            'key_pairs': 100}
56
55
 
57
56
        quota_set = self.controller._format_quota_set('1234', raw_quota_set)
58
57
        qs = quota_set['quota_set']
88
87
                    'injected_file_content_bytes': 10240,
89
88
                    'security_groups': 10,
90
89
                    'security_group_rules': 20,
91
 
                    'key_pairs': 100,
92
 
                    }}
 
90
                    'key_pairs': 100}}
93
91
 
94
92
        self.assertEqual(res_dict, expected)
95
93
 
145
143
        self.assertRaises(webob.exc.HTTPBadRequest, self.controller.update,
146
144
                          req, 'update_me', body)
147
145
 
 
146
    def test_quotas_update_invalid_value(self):
 
147
        expected_resp = {'quota_set': {
 
148
                              'instances': 50, 'cores': 50,
 
149
                              'ram': 51200, 'floating_ips': 10,
 
150
                              'metadata_items': 128, 'injected_files': 5,
 
151
                              'injected_file_content_bytes': 10240,
 
152
                              'injected_file_path_bytes': 255,
 
153
                              'security_groups': 10,
 
154
                              'security_group_rules': 20,
 
155
                              'key_pairs': 100}}
 
156
 
 
157
        # when PUT JSON format with empty string for quota
 
158
        body = {'quota_set': {'instances': 50, 'cores': 50,
 
159
                              'ram': '', 'floating_ips': 10,
 
160
                              'metadata_items': 128, 'injected_files': 5,
 
161
                              'injected_file_content_bytes': 10240,
 
162
                              'injected_file_path_bytes': 255,
 
163
                              'security_groups': 10,
 
164
                              'security_group_rules': 20,
 
165
                              'key_pairs': 100}}
 
166
        req = fakes.HTTPRequest.blank('/v2/fake4/os-quota-sets/update_me',
 
167
                                      use_admin_context=True)
 
168
        res_dict = self.controller.update(req, 'update_me', body)
 
169
        self.assertEqual(res_dict, expected_resp)
 
170
 
 
171
        # when PUT XML format with empty string for quota
 
172
        body = {'quota_set': {'instances': 50, 'cores': 50,
 
173
                              'ram': {}, 'floating_ips': 10,
 
174
                              'metadata_items': 128, 'injected_files': 5,
 
175
                              'injected_file_content_bytes': 10240,
 
176
                              'injected_file_path_bytes': 255,
 
177
                              'security_groups': 10,
 
178
                              'security_group_rules': 20,
 
179
                              'key_pairs': 100}}
 
180
        req = fakes.HTTPRequest.blank('/v2/fake4/os-quota-sets/update_me',
 
181
                                      use_admin_context=True)
 
182
        res_dict = self.controller.update(req, 'update_me', body)
 
183
        self.assertEqual(res_dict, expected_resp)
 
184
 
148
185
 
149
186
class QuotaXMLSerializerTest(test.TestCase):
150
187
    def setUp(self):
168
205
                cores=90))
169
206
        text = self.serializer.serialize(exemplar)
170
207
 
171
 
        print text
172
208
        tree = etree.fromstring(text)
173
209
 
174
210
        self.assertEqual('quota_set', tree.tag)