Skip to content

Commit f764250

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Add router functional tests"
2 parents c20f9a8 + 1db40e8 commit f764250

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

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 RouterTests(test.TestCase):
19+
"""Functional tests for router. """
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('router 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('router delete ' + cls.NAME)
34+
cls.assertOutput('', raw_output)
35+
36+
def test_router_list(self):
37+
opts = self.get_list_opts(self.HEADERS)
38+
raw_output = self.openstack('router list' + opts)
39+
self.assertIn(self.NAME, raw_output)
40+
41+
def test_router_set(self):
42+
self.openstack('router set --disable ' + self.NAME)
43+
opts = self.get_show_opts(['name', 'admin_state_up'])
44+
raw_output = self.openstack('router show ' + self.NAME + opts)
45+
self.assertEqual("DOWN\n" + self.NAME + "\n", raw_output)
46+
47+
def test_router_show(self):
48+
opts = self.get_show_opts(self.FIELDS)
49+
raw_output = self.openstack('router show ' + self.NAME + opts)
50+
self.assertEqual(self.NAME + "\n", raw_output)

0 commit comments

Comments
 (0)