/
usr
/
lib
/
python2.6
/
site-packages
/
novaclient
/
tests
/
unit
/
v2
/
/usr/lib/python2.6/site-packages/novaclient/tests/unit/v2
mkdir
upload
Name
Size
Mode
Actions
contrib/
-
0755
rm
fakes.py
85577
0644
edit
dl
rm
fakes.pyc
89935
0644
edit
dl
rm
testfile.txt
5
0644
edit
dl
rm
test_agents.py
3994
0644
edit
dl
rm
test_agents.pyc
4019
0644
edit
dl
rm
test_aggregates.py
5757
0644
edit
dl
rm
test_aggregates.pyc
5700
0644
edit
dl
rm
test_auth.py
14296
0644
edit
dl
rm
test_auth.pyc
13067
0644
edit
dl
rm
test_availability_zone.py
3913
0644
edit
dl
rm
test_availability_zone.pyc
4127
0644
edit
dl
rm
test_certs.py
1380
0644
edit
dl
rm
test_certs.pyc
1549
0644
edit
dl
rm
test_client.py
1534
0644
edit
dl
rm
test_client.pyc
1492
0644
edit
dl
rm
test_cloudpipe.py
1757
0644
edit
dl
rm
test_cloudpipe.pyc
2076
0644
edit
dl
rm
test_fixed_ips.py
1785
0644
edit
dl
rm
test_fixed_ips.pyc
2083
0644
edit
dl
rm
test_flavors.py
8919
0644
edit
dl
rm
test_flavors.pyc
10988
0644
edit
dl
rm
test_flavor_access.py
2381
0644
edit
dl
rm
test_flavor_access.pyc
2828
0644
edit
dl
rm
test_floating_ips.py
2275
0644
edit
dl
rm
test_floating_ips.pyc
2720
0644
edit
dl
rm
test_floating_ips_bulk.py
3094
0644
edit
dl
rm
test_floating_ips_bulk.pyc
3466
0644
edit
dl
rm
test_floating_ip_dns.py
3529
0644
edit
dl
rm
test_floating_ip_dns.pyc
4313
0644
edit
dl
rm
test_floating_ip_pools.py
1237
0644
edit
dl
rm
test_floating_ip_pools.pyc
1230
0644
edit
dl
rm
test_fping.py
2242
0644
edit
dl
rm
test_fping.pyc
3020
0644
edit
dl
rm
test_hosts.py
3144
0644
edit
dl
rm
test_hosts.pyc
4445
0644
edit
dl
rm
test_hypervisors.py
6171
0644
edit
dl
rm
test_hypervisors.pyc
5914
0644
edit
dl
rm
test_images.py
2551
0644
edit
dl
rm
test_images.pyc
3713
0644
edit
dl
rm
test_keypairs.py
3941
0644
edit
dl
rm
test_keypairs.pyc
5357
0644
edit
dl
rm
test_limits.py
3160
0644
edit
dl
rm
test_limits.pyc
3066
0644
edit
dl
rm
test_networks.py
4036
0644
edit
dl
rm
test_networks.pyc
5257
0644
edit
dl
rm
test_quotas.py
2292
0644
edit
dl
rm
test_quotas.pyc
2876
0644
edit
dl
rm
test_quota_classes.py
1421
0644
edit
dl
rm
test_quota_classes.pyc
1713
0644
edit
dl
rm
test_security_groups.py
3135
0644
edit
dl
rm
test_security_groups.pyc
4116
0644
edit
dl
rm
test_security_group_rules.py
3573
0644
edit
dl
rm
test_security_group_rules.pyc
3653
0644
edit
dl
rm
test_servers.py
31014
0644
edit
dl
rm
test_servers.pyc
36756
0644
edit
dl
rm
test_server_groups.py
2769
0644
edit
dl
rm
test_server_groups.pyc
3240
0644
edit
dl
rm
test_server_migrations.py
3433
0644
edit
dl
rm
test_server_migrations.pyc
4707
0644
edit
dl
rm
test_services.py
5126
0644
edit
dl
rm
test_services.pyc
6643
0644
edit
dl
rm
test_shell.py
110887
0644
edit
dl
rm
test_shell.pyc
137901
0644
edit
dl
rm
test_usage.py
1903
0644
edit
dl
rm
test_usage.pyc
2578
0644
edit
dl
rm
test_versions.py
3649
0644
edit
dl
rm
test_versions.pyc
3770
0644
edit
dl
rm
test_volumes.py
4021
0644
edit
dl
rm
test_volumes.pyc
5136
0644
edit
dl
rm
__init__.py
0
0644
edit
dl
rm
__init__.pyc
163
0644
edit
dl
rm
Edit:
/usr/lib/python2.6/site-packages/novaclient/tests/unit/v2/test_agents.py
(3994B)
# Copyright 2012 IBM Corp. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from novaclient.tests.unit.fixture_data import agents as data from novaclient.tests.unit.fixture_data import client from novaclient.tests.unit import utils from novaclient.v2 import agents class AgentsTest(utils.FixturedTestCase): data_fixture_class = data.Fixture scenarios = [('original', {'client_fixture_class': client.V1}), ('session', {'client_fixture_class': client.SessionV1})] def stub_hypervisors(self, hypervisor='kvm'): get_os_agents = { 'agents': [ { 'hypervisor': hypervisor, 'os': 'win', 'architecture': 'x86', 'version': '7.0', 'url': 'xxx://xxxx/xxx/xxx', 'md5hash': 'add6bb58e139be103324d04d82d8f545', 'id': 1 }, { 'hypervisor': hypervisor, 'os': 'linux', 'architecture': 'x86', 'version': '16.0', 'url': 'xxx://xxxx/xxx/xxx1', 'md5hash': 'add6bb58e139be103324d04d82d8f546', 'id': 2 }, ] } headers = {'Content-Type': 'application/json'} self.requests.register_uri('GET', self.data_fixture.url(), json=get_os_agents, headers=headers) def test_list_agents(self): self.stub_hypervisors() ags = self.cs.agents.list() self.assert_called('GET', '/os-agents') for a in ags: self.assertIsInstance(a, agents.Agent) self.assertEqual('kvm', a.hypervisor) def test_list_agents_with_hypervisor(self): self.stub_hypervisors('xen') ags = self.cs.agents.list('xen') self.assert_called('GET', '/os-agents?hypervisor=xen') for a in ags: self.assertIsInstance(a, agents.Agent) self.assertEqual('xen', a.hypervisor) def test_agents_create(self): ag = self.cs.agents.create('win', 'x86', '7.0', '/xxx/xxx/xxx', 'add6bb58e139be103324d04d82d8f546', 'xen') body = {'agent': {'url': '/xxx/xxx/xxx', 'hypervisor': 'xen', 'md5hash': 'add6bb58e139be103324d04d82d8f546', 'version': '7.0', 'architecture': 'x86', 'os': 'win'}} self.assert_called('POST', '/os-agents', body) self.assertEqual(1, ag._info.copy()['id']) def test_agents_delete(self): self.cs.agents.delete('1') self.assert_called('DELETE', '/os-agents/1') def _build_example_update_body(self): return {"para": { "url": "/yyy/yyyy/yyyy", "version": "8.0", "md5hash": "add6bb58e139be103324d04d82d8f546"}} def test_agents_modify(self): ag = self.cs.agents.update('1', '8.0', '/yyy/yyyy/yyyy', 'add6bb58e139be103324d04d82d8f546') body = self._build_example_update_body() self.assert_called('PUT', '/os-agents/1', body) self.assertEqual(1, ag.id)
Save
cmd:
run