

def test_keypair_create(self):
    'Test keypair create command.\n\n        Test steps:\n        1) Create keypair in setUp\n        2) Check RSA private key in output\n        3) Check for new keypair in keypairs list\n        '
    NewName = data_utils.rand_name('TestKeyPairCreated')
    raw_output = self.openstack(('keypair create ' + NewName))
    self.addCleanup(self.openstack, ('keypair delete ' + NewName))
    self.assertInOutput('-----BEGIN RSA PRIVATE KEY-----', raw_output)
    self.assertRegex(raw_output, '[0-9A-Za-z+/]+[=]{0,3}\n')
    self.assertInOutput('-----END RSA PRIVATE KEY-----', raw_output)
    self.assertIn(NewName, self.keypair_list())

dataset/ETHPy150Open dtroyer/python-openstackclient/functional/tests/compute/v2/test_keypair.py KeypairTests.test_keypair_create/original