1
# -*- coding: utf-8 -*-
3
# Copyright (C) 2015 Intel Corporation. All Rights Reserved.
5
# Licensed under the Apache License, Version 2.0 (the "License"); you may
6
# not use this file except in compliance with the License. You may obtain
7
# a copy of the License at
9
# http://www.apache.org/licenses/LICENSE-2.0
11
# Unless required by applicable law or agreed to in writing, software
12
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
# License for the specific language governing permissions and limitations
17
from ironic.common import states
18
from ironic.tests import base
21
class StatesTest(base.TestCase):
23
def test_state_values_length(self):
24
"""test_state_values_length
26
State values can be a maximum of 15 characters because they are stored
27
in the database and the size of the database entry is 15 characters.
28
This is specified in db/sqlalchemy/models.py
31
for key, value in states.__dict__.iteritems():
32
# Assumption: A state variable name is all UPPERCASE and contents
34
if key.upper() == key and isinstance(value, basestring):
37
"Value for state: {} is greater than 15 characters".format(