'Test main good with add and auto_run. Config updated, task created.'

@patch('ansible.modules.network.cloudvision.cv_server_provision.wait_for_task_completion')
@patch('ansible.modules.network.cloudvision.cv_server_provision.configlet_update_task')
@patch('ansible.modules.network.cloudvision.cv_server_provision.configlet_action')
@patch('ansible.modules.network.cloudvision.cv_server_provision.port_configurable')
@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_add_auto_run(self, mock_module, mock_connect, mock_info, mock_comp, mock_server_conf, mock_port_conf, mock_conf_action, mock_conf_task, mock_wait):

    mock_module_object = Mock()
    mock_module_object.params = dict(action='add', switch_name='eos', switch_port='3', auto_run=True)
    mock_module.return_value = mock_module_object
    mock_client_object = Mock()
    mock_connect.return_value = mock_client_object
    mock_info.return_value = 'Info'
    mock_server_conf.return_value = 'Configlet'
    mock_port_conf.return_value = 'Port'
    mock_conf_action.return_value = dict(taskCreated=True, changed=True)
    mock_conf_task.return_value = '7'
    mock_wait.return_value = True
    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)
    self.assertEqual(mock_port_conf.call_count, 1)
    self.assertEqual(mock_conf_action.call_count, 1)
    self.assertEqual(mock_conf_task.call_count, 1)
    self.assertEqual(mock_wait.call_count, 1)
    mock_module_object.fail_json.assert_not_called()
    return_dict = dict(changed=True, switchInfo='Info', taskId='7', switchConfigurable=True, portConfigurable=True, taskCreated=True, taskExecuted=True, taskCompleted=True)
    mock_module_object.exit_json.assert_called_with(**return_dict)
