Skip to content

Commit f8bbbdc

Browse files
committed
Add support for keypair functional tests
Change-Id: I5d4730f8229b50d2b162864c74d8eabfef6c0991
1 parent 29f29e4 commit f8bbbdc

3 files changed

Lines changed: 44 additions & 0 deletions

File tree

‎functional/tests/compute/__init__.py‎

Whitespace-only changes.

‎functional/tests/compute/v2/__init__.py‎

Whitespace-only changes.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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 KeypairTests(test.TestCase):
19+
"""Functional tests for compute keypairs. """
20+
NAME = uuid.uuid4().hex
21+
HEADERS = ['Name']
22+
FIELDS = ['deleted_at', 'name', 'updated_at']
23+
24+
@classmethod
25+
def setUpClass(cls):
26+
private_key = cls.openstack('keypair create ' + cls.NAME)
27+
cls.assertInOutput('-----BEGIN RSA PRIVATE KEY-----', private_key)
28+
cls.assertInOutput('-----END RSA PRIVATE KEY-----', private_key)
29+
30+
@classmethod
31+
def tearDownClass(cls):
32+
raw_output = cls.openstack('keypair delete ' + cls.NAME)
33+
cls.assertOutput('', raw_output)
34+
35+
def test_keypair_list(self):
36+
opts = self.get_list_opts(self.HEADERS)
37+
raw_output = self.openstack('keypair list' + opts)
38+
self.assertIn(self.NAME, raw_output)
39+
40+
def test_keypair_show(self):
41+
opts = self.get_show_opts(self.FIELDS)
42+
raw_output = self.openstack('keypair show ' + self.NAME + opts)
43+
expected = "None\n" + self.NAME + "\nNone\n"
44+
self.assertEqual(expected, raw_output)

0 commit comments

Comments
 (0)