def test_current_iface_config(mock_module, mock_exists):
    """
    cl_interface - test getting current iface config
    """
    mock_module.params = {"name": "swp1", "location": "/etc/network/ansible"}
    mock_exists.return_value = True
    mock_module.run_command = MagicMock()
    # mock AnsibleModule.run_command
    json_output = open("tests/ifquery.json").read()
    mock_module.run_command.return_value = (0, json_output, None)
    mock_module.from_json.return_value = json.loads(json_output)
    cl_int.current_iface_config(mock_module)
    current_config = mock_module.custom_current_config.get("config")
    assert_equals(current_config.get("address"), "10.152.5.10/24")
    mock_exists.assert_called_with("/etc/network/ansible/swp1")
    mock_module.run_command.assert_called_with("/sbin/ifquery -o json swp1")
def test_current_iface_config(mock_module, mock_exists):
    """
    cl_interface - test getting current iface config
    """
    mock_module.params = {'name': 'swp1', 'location': '/etc/network/ansible'}
    mock_exists.return_value = True
    mock_module.run_command = MagicMock()
    # mock AnsibleModule.run_command
    json_output = open('tests/ifquery.json').read()
    mock_module.run_command.return_value = \
        (0, json_output, None)
    mock_module.from_json.return_value = json.loads(json_output)
    cl_int.current_iface_config(mock_module)
    current_config = mock_module.custom_current_config.get('config')
    assert_equals(current_config.get('address'), '10.152.5.10/24')
    mock_exists.assert_called_with('/etc/network/ansible/swp1')
    mock_module.run_command.assert_called_with('/sbin/ifquery -o json swp1')