Skip to content

Commit f48f939

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Add fixed keypair create functional test"
2 parents f3b5823 + 029654b commit f48f939

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

functional/tests/compute/v2/test_keypair.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,22 @@
1010
# License for the specific language governing permissions and limitations
1111
# under the License.
1212

13+
import os
1314
import uuid
1415

1516
from functional.common import test
1617

1718

19+
PUBLIC_KEY = (
20+
'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWNGczJxNaFUrJJVhta4dWsZY6bU'
21+
'5HUMPbyfSMu713ca3mYtG848W4dfDCB98KmSQx2Bl0D6Q2nrOszOXEQWAXNdfMadnW'
22+
'c4mNwhZcPBVohIFoC1KZJC8kcBTvFZcoz3mdIijxJtywZNpGNh34VRJlZeHyYjg8/D'
23+
'esHzdoBVd5c/4R36emQSIV9ukY6PHeZ3scAH4B3K9PxItJBwiFtouSRphQG0bJgOv/'
24+
'gjAjMElAvg5oku98cb4QiHZ8T8WY68id804raHR6pJxpVVJN4TYJmlUs+NOVM+pPKb'
25+
'KJttqrIBTkawGK9pLHNfn7z6v1syvUo/4enc1l0Q/Qn2kWiz67 fake@openstack'
26+
)
27+
28+
1829
class KeypairTests(test.TestCase):
1930
"""Functional tests for compute keypairs. """
2031
NAME = uuid.uuid4().hex
@@ -32,6 +43,21 @@ def tearDownClass(cls):
3243
raw_output = cls.openstack('keypair delete ' + cls.NAME)
3344
cls.assertOutput('', raw_output)
3445

46+
def test_keypair_create(self):
47+
TMP_FILE = uuid.uuid4().hex
48+
self.addCleanup(os.remove, TMP_FILE)
49+
with open(TMP_FILE, 'w') as f:
50+
f.write(PUBLIC_KEY)
51+
52+
raw_output = self.openstack(
53+
'keypair create --public-key ' + TMP_FILE + ' tmpkey',
54+
)
55+
self.addCleanup(
56+
self.openstack,
57+
'keypair delete tmpkey',
58+
)
59+
self.assertIn('tmpkey', raw_output)
60+
3561
def test_keypair_list(self):
3662
opts = self.get_list_opts(self.HEADERS)
3763
raw_output = self.openstack('keypair list' + opts)

0 commit comments

Comments
 (0)