/
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_security_group_rules.py
(3573B)
# # 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 import exceptions from novaclient.tests.unit.fixture_data import client from novaclient.tests.unit.fixture_data import security_group_rules as data from novaclient.tests.unit import utils from novaclient.v2 import security_group_rules class SecurityGroupRulesTest(utils.FixturedTestCase): client_fixture_class = client.V1 data_fixture_class = data.Fixture def test_delete_security_group_rule(self): self.cs.security_group_rules.delete(1) self.assert_called('DELETE', '/os-security-group-rules/1') def test_create_security_group_rule(self): sg = self.cs.security_group_rules.create(1, "tcp", 1, 65535, "10.0.0.0/16") body = { "security_group_rule": { "ip_protocol": "tcp", "from_port": 1, "to_port": 65535, "cidr": "10.0.0.0/16", "group_id": None, "parent_group_id": 1, } } self.assert_called('POST', '/os-security-group-rules', body) self.assertTrue(isinstance(sg, security_group_rules.SecurityGroupRule)) def test_create_security_group_group_rule(self): sg = self.cs.security_group_rules.create(1, "tcp", 1, 65535, "10.0.0.0/16", 101) body = { "security_group_rule": { "ip_protocol": "tcp", "from_port": 1, "to_port": 65535, "cidr": "10.0.0.0/16", "group_id": 101, "parent_group_id": 1, } } self.assert_called('POST', '/os-security-group-rules', body) self.assertTrue(isinstance(sg, security_group_rules.SecurityGroupRule)) def test_invalid_parameters_create(self): self.assertRaises(exceptions.CommandError, self.cs.security_group_rules.create, 1, "invalid_ip_protocol", 1, 65535, "10.0.0.0/16", 101) self.assertRaises(exceptions.CommandError, self.cs.security_group_rules.create, 1, "tcp", "invalid_from_port", 65535, "10.0.0.0/16", 101) self.assertRaises(exceptions.CommandError, self.cs.security_group_rules.create, 1, "tcp", 1, "invalid_to_port", "10.0.0.0/16", 101) def test_security_group_rule_str(self): sg = self.cs.security_group_rules.create(1, "tcp", 1, 65535, "10.0.0.0/16") self.assertEqual('1', str(sg)) def test_security_group_rule_del(self): sg = self.cs.security_group_rules.create(1, "tcp", 1, 65535, "10.0.0.0/16") sg.delete() self.assert_called('DELETE', '/os-security-group-rules/1')
Save
cmd:
run