'Test creation of a keypair whose name is of excess length.'

def test_create_key_excess_name_length(self):

    key_name = ('k' * 256)
    template = copy.deepcopy(self.kp_template)
    template['resources']['kp']['properties']['name'] = key_name
    stack = utils.parse_stack(template)
    definition = stack.t.resource_definitions(stack)['kp']
    kp_res = keypair.KeyPair('kp', definition, stack)
    error = self.assertRaises(exception.StackValidationFailed, kp_res.validate)
    self.assertIn('Property    error', six.text_type(error))
    self.assertIn('kp.properties.name:    length    (256)    is    out    of    range    (min:    1,    max:    255)', six.text_type(error))
