Skip to content

Commit 3dc97c0

Browse files
committed
Add functional tests for network crud
Change-Id: If965a7389ffa5b7ad44f53eebc2e8b918c6d2ace
1 parent 11ea5b3 commit 3dc97c0

3 files changed

Lines changed: 50 additions & 0 deletions

File tree

functional/tests/network/__init__.py

Whitespace-only changes.

functional/tests/network/v2/__init__.py

Whitespace-only changes.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
2+
# not use this file except in compliance with the License. You may obtain
3+
# a copy of the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
# License for the specific language governing permissions and limitations
11+
# under the License.
12+
13+
import uuid
14+
15+
from functional.common import test
16+
17+
18+
class NetworkTests(test.TestCase):
19+
"""Functional tests for network. """
20+
NAME = uuid.uuid4().hex
21+
HEADERS = ['Name']
22+
FIELDS = ['name']
23+
24+
@classmethod
25+
def setUpClass(cls):
26+
opts = cls.get_show_opts(cls.FIELDS)
27+
raw_output = cls.openstack('network create ' + cls.NAME + opts)
28+
expected = cls.NAME + '\n'
29+
cls.assertOutput(expected, raw_output)
30+
31+
@classmethod
32+
def tearDownClass(cls):
33+
raw_output = cls.openstack('network delete ' + cls.NAME)
34+
cls.assertOutput('', raw_output)
35+
36+
def test_network_list(self):
37+
opts = self.get_list_opts(self.HEADERS)
38+
raw_output = self.openstack('network list' + opts)
39+
self.assertIn(self.NAME, raw_output)
40+
41+
def test_network_set(self):
42+
raw_output = self.openstack('network set --disable ' + self.NAME)
43+
opts = self.get_show_opts(['name', 'state'])
44+
raw_output = self.openstack('network show ' + self.NAME + opts)
45+
self.assertEqual(self.NAME + "\nDOWN\n", raw_output)
46+
47+
def test_network_show(self):
48+
opts = self.get_show_opts(self.FIELDS)
49+
raw_output = self.openstack('network show ' + self.NAME + opts)
50+
self.assertEqual(self.NAME + "\n", raw_output)

0 commit comments

Comments
 (0)