~ubuntu-branches/ubuntu/vivid/ironic/vivid-updates

« back to all changes in this revision

Viewing changes to ironic/tests/drivers/test_ipminative.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2015-03-30 11:14:57 UTC
  • mfrom: (1.2.6)
  • Revision ID: package-import@ubuntu.com-20150330111457-kr4ju3guf22m4vbz
Tags: 2015.1~b3-0ubuntu1
* New upstream release.
  + d/control: 
    - Align with upstream dependencies.
    - Add dh-python to build-dependencies.
    - Add psmisc as a dependency. (LP: #1358820)
  + d/p/fix-requirements.patch: Rediffed.
  + d/ironic-conductor.init.in: Fixed typos in LSB headers,
    thanks to JJ Asghar. (LP: #1429962)

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
import mock
23
23
from oslo_config import cfg
 
24
from oslo_utils import uuidutils
24
25
from pyghmi import exceptions as pyghmi_exception
25
26
 
26
27
from ironic.common import boot_devices
27
28
from ironic.common import driver_factory
28
29
from ironic.common import exception
29
30
from ironic.common import states
30
 
from ironic.common import utils
31
31
from ironic.conductor import task_manager
32
32
from ironic.drivers.modules import console_utils
33
33
from ironic.drivers.modules import ipminative
148
148
        ipmicmd.get_sensor_data.return_value = readings
149
149
        expected = {
150
150
              'fake_type_A': {
151
 
                'fake_name1': {
152
 
                  'Health': '0',
153
 
                  'Sensor ID': 'fake_name1',
154
 
                  'Sensor Reading': 'fake_value1 fake_units',
155
 
                  'States': '[]',
156
 
                  'Units': 'fake_units'
157
 
                },
158
 
                'fake_name2': {
159
 
                  'Health': '0',
160
 
                  'Sensor ID': 'fake_name2',
161
 
                  'Sensor Reading': 'fake_value2 fake_units',
162
 
                  'States': '[]',
163
 
                  'Units': 'fake_units'
164
 
                }
 
151
                  'fake_name1': {
 
152
                      'Health': '0',
 
153
                      'Sensor ID': 'fake_name1',
 
154
                      'Sensor Reading': 'fake_value1 fake_units',
 
155
                      'States': '[]',
 
156
                      'Units': 'fake_units'
 
157
                  },
 
158
                  'fake_name2': {
 
159
                      'Health': '0',
 
160
                      'Sensor ID': 'fake_name2',
 
161
                      'Sensor Reading': 'fake_value2 fake_units',
 
162
                      'States': '[]',
 
163
                      'Units': 'fake_units'
 
164
                  }
165
165
              },
166
166
              'fake_type_B': {
167
 
                'fake_name3': {
168
 
                  'Health': '0',
169
 
                  'Sensor ID': 'fake_name3',
170
 
                  'Sensor Reading': 'fake_value3 fake_units',
171
 
                  'States': '[]', 'Units': 'fake_units'
172
 
                }
 
167
                  'fake_name3': {
 
168
                      'Health': '0',
 
169
                      'Sensor ID': 'fake_name3',
 
170
                      'Sensor Reading': 'fake_value3 fake_units',
 
171
                      'States': '[]', 'Units': 'fake_units'
 
172
                  }
173
173
              }
174
 
            }
 
174
        }
175
175
        ret = ipminative._get_sensors_data(self.info)
176
176
        self.assertEqual(expected, ret)
177
177
 
192
192
 
193
193
        expected = {
194
194
              'fake_type_A': {
195
 
                'fake_name1': {
196
 
                  'Health': '0',
197
 
                  'Sensor ID': 'fake_name1',
198
 
                  'Sensor Reading': 'fake_value1 fake_units',
199
 
                  'States': '[]',
200
 
                  'Units': 'fake_units'
201
 
                }
 
195
                  'fake_name1': {
 
196
                      'Health': '0',
 
197
                      'Sensor ID': 'fake_name1',
 
198
                      'Sensor Reading': 'fake_value1 fake_units',
 
199
                      'States': '[]',
 
200
                      'Units': 'fake_units'
 
201
                  }
202
202
              }
203
 
            }
 
203
        }
204
204
        ret = ipminative._get_sensors_data(self.info)
205
205
        self.assertEqual(expected, ret)
206
206
 
388
388
    def test_management_interface_validate_fail(self):
389
389
        # Missing IPMI driver_info information
390
390
        node = obj_utils.create_test_node(self.context,
391
 
                                          uuid=utils.generate_uuid(),
 
391
                                          uuid=uuidutils.generate_uuid(),
392
392
                                          driver='fake_ipminative')
393
393
        with task_manager.acquire(self.context, node.uuid) as task:
394
394
            self.assertRaises(exception.MissingParameterValue,