summaryrefslogtreecommitdiff
path: root/novaclient/tests/unit/v2/contrib/test_tenant_networks.py
diff options
context:
space:
mode:
Diffstat (limited to 'novaclient/tests/unit/v2/contrib/test_tenant_networks.py')
-rw-r--r--novaclient/tests/unit/v2/contrib/test_tenant_networks.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/novaclient/tests/unit/v2/contrib/test_tenant_networks.py b/novaclient/tests/unit/v2/contrib/test_tenant_networks.py
new file mode 100644
index 0000000..13159ce
--- /dev/null
+++ b/novaclient/tests/unit/v2/contrib/test_tenant_networks.py
@@ -0,0 +1,46 @@
1# Copyright 2012 OpenStack Foundation
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16from novaclient import extension
17from novaclient.tests.unit import utils
18from novaclient.tests.unit.v2.contrib import fakes
19from novaclient.v2.contrib import tenant_networks
20
21
22extensions = [
23 extension.Extension(tenant_networks.__name__.split(".")[-1],
24 tenant_networks),
25]
26cs = fakes.FakeClient(extensions=extensions)
27
28
29class TenantNetworkExtensionTests(utils.TestCase):
30 def test_list_tenant_networks(self):
31 nets = cs.tenant_networks.list()
32 cs.assert_called('GET', '/os-tenant-networks')
33 self.assertTrue(len(nets) > 0)
34
35 def test_get_tenant_network(self):
36 cs.tenant_networks.get(1)
37 cs.assert_called('GET', '/os-tenant-networks/1')
38
39 def test_create_tenant_networks(self):
40 cs.tenant_networks.create(label="net",
41 cidr="10.0.0.0/24")
42 cs.assert_called('POST', '/os-tenant-networks')
43
44 def test_delete_tenant_networks(self):
45 cs.tenant_networks.delete(1)
46 cs.assert_called('DELETE', '/os-tenant-networks/1')