Revision 255e19d4 test/ganeti.config_unittest.py

b/test/ganeti.config_unittest.py
152 152
    # but the fake_instance update should still fail
153 153
    self.failUnlessRaises(errors.ConfigurationError, cfg.Update, fake_instance)
154 154

  
155
  def testNICParameterSyntaxCheck(self):
156
    """Test the NIC's CheckParameterSyntax function"""
157
    mode = constants.NIC_MODE
158
    link = constants.NIC_LINK
159
    m_bridged = constants.NIC_MODE_BRIDGED
160
    m_routed = constants.NIC_MODE_ROUTED
161
    CheckSyntax = objects.NIC.CheckParameterSyntax
162

  
163
    CheckSyntax(constants.NICC_DEFAULTS)
164
    CheckSyntax({mode: m_bridged, link: 'br1'})
165
    CheckSyntax({mode: m_routed, link: 'default'})
166
    self.assertRaises(errors.ConfigurationError,
167
                      CheckSyntax, {mode: '000invalid', link: 'any'})
168
    self.assertRaises(errors.ConfigurationError,
169
                      CheckSyntax, {mode: m_bridged, link: None})
170
    self.assertRaises(errors.ConfigurationError,
171
                      CheckSyntax, {mode: m_bridged, link: ''})
172

  
155 173

  
156 174
if __name__ == '__main__':
157 175
  unittest.main()

Also available in: Unified diff