def test_server_configurable_configlet_no_configlets(self):
     ''' Test server_configurable_configlet fail. No switch configlets.
     '''
     module = Mock()
     module.params = dict(switch_name='eos')
     module.client.api.get_configlets_by_device_id.return_value = []
     sw_info = dict(key='key', type='type', fqdn='eos')
     result = cv_server_provision.server_configurable_configlet(module,
                                                                sw_info)
     self.assertEqual(module.client.api.get_configlets_by_device_id.call_count, 1)
     self.assertIsNone(result)
 def test_server_configurable_configlet_no_configlets(self):
     ''' Test server_configurable_configlet fail. No switch configlets.
     '''
     module = Mock()
     module.params = dict(switch_name='eos')
     module.client.api.get_configlets_by_device_id.return_value = []
     sw_info = dict(key='key', type='type', fqdn='eos')
     result = cv_server_provision.server_configurable_configlet(
         module, sw_info)
     self.assertEqual(
         module.client.api.get_configlets_by_device_id.call_count, 1)
     self.assertIsNone(result)
 def test_server_configurable_configlet_not_configurable(self):
     ''' Test server_configurable_configlet fail. No server configlet.
     '''
     module = Mock()
     module.params = dict(switch_name='eos')
     configlets = [dict(name='configlet1', info='line'),
                   dict(name='configlet2', info='info')]
     module.client.api.get_configlets_by_device_id.return_value = configlets
     sw_info = dict(key='key', type='type', fqdn='eos')
     result = cv_server_provision.server_configurable_configlet(module, sw_info)
     self.assertEqual(module.client.api.get_configlets_by_device_id.call_count, 1)
     self.assertIsNone(result)
 def test_server_configurable_configlet_not_configurable(self):
     ''' Test server_configurable_configlet fail. No server configlet.
     '''
     module = Mock()
     module.params = dict(switch_name='eos')
     configlets = [
         dict(name='configlet1', info='line'),
         dict(name='configlet2', info='info')
     ]
     module.client.api.get_configlets_by_device_id.return_value = configlets
     sw_info = dict(key='key', type='type', fqdn='eos')
     result = cv_server_provision.server_configurable_configlet(
         module, sw_info)
     self.assertEqual(
         module.client.api.get_configlets_by_device_id.call_count, 1)
     self.assertIsNone(result)