'Test main fails if switch has no configlet for Ansible to edit.'

@patch('ansible.modules.network.cloudvision.cv_server_provision.CvpApiError', new_callable=(lambda : MockException))
@patch('ansible.modules.network.cloudvision.cv_server_provision.server_configurable_configlet')
@patch('ansible.modules.network.cloudvision.cv_server_provision.switch_in_compliance')
@patch('ansible.modules.network.cloudvision.cv_server_provision.switch_info')
@patch('ansible.modules.network.cloudvision.cv_server_provision.connect')
@patch('ansible.modules.network.cloudvision.cv_server_provision.AnsibleModule')
def test_main_no_switch_configlet(self, mock_module, mock_connect, mock_info, mock_comp, mock_server_conf, mock_exception):

    mock_module_object = Mock()
    mock_module_object.params = dict(action='add', switch_name='eos')
    mock_module_object.fail_json.side_effect = SystemExit('Exiting')
    mock_module.return_value = mock_module_object
    mock_connect.return_value = 'Client'
    mock_info.return_value = 'Info'
    mock_server_conf.return_value = None
    self.assertRaises(SystemExit, cv_server_provision.main)
    self.assertEqual(mock_connect.call_count, 1)
    self.assertEqual(mock_info.call_count, 1)
    self.assertEqual(mock_comp.call_count, 1)
    self.assertEqual(mock_server_conf.call_count, 1)
    mock_module_object.fail_json.assert_called_with(msg='Switch    eos    has    no    configurable    server    ports.')
