summaryrefslogtreecommitdiff
path: root/novaclient/tests/unit/v2/test_cloudpipe.py
diff options
context:
space:
mode:
Diffstat (limited to 'novaclient/tests/unit/v2/test_cloudpipe.py')
-rw-r--r--novaclient/tests/unit/v2/test_cloudpipe.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/novaclient/tests/unit/v2/test_cloudpipe.py b/novaclient/tests/unit/v2/test_cloudpipe.py
new file mode 100644
index 0000000..3ef9533
--- /dev/null
+++ b/novaclient/tests/unit/v2/test_cloudpipe.py
@@ -0,0 +1,45 @@
1#
2# Licensed under the Apache License, Version 2.0 (the "License"); you may
3# not use this file except in compliance with the License. You may obtain
4# a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11# License for the specific language governing permissions and limitations
12# under the License.
13
14import six
15
16from novaclient.tests.unit.fixture_data import client
17from novaclient.tests.unit.fixture_data import cloudpipe as data
18from novaclient.tests.unit import utils
19from novaclient.v2 import cloudpipe
20
21
22class CloudpipeTest(utils.FixturedTestCase):
23
24 data_fixture_class = data.Fixture
25
26 scenarios = [('original', {'client_fixture_class': client.V1}),
27 ('session', {'client_fixture_class': client.SessionV1})]
28
29 def test_list_cloudpipes(self):
30 cp = self.cs.cloudpipe.list()
31 self.assert_called('GET', '/os-cloudpipe')
32 [self.assertIsInstance(c, cloudpipe.Cloudpipe) for c in cp]
33
34 def test_create(self):
35 project = "test"
36 cp = self.cs.cloudpipe.create(project)
37 body = {'cloudpipe': {'project_id': project}}
38 self.assert_called('POST', '/os-cloudpipe', body)
39 self.assertIsInstance(cp, six.string_types)
40
41 def test_update(self):
42 self.cs.cloudpipe.update("192.168.1.1", 2345)
43 body = {'configure_project': {'vpn_ip': "192.168.1.1",
44 'vpn_port': 2345}}
45 self.assert_called('PUT', '/os-cloudpipe/configure-project', body)