Ejemplo n.º 1
0
def test_read_file_return(mocker, get_sample):
    data = get_sample('ifconfig.out')
    mock_open = mocker.mock_open(read_data=data)
    if PY2:
        mocker.patch('__builtin__.open', mock_open)
    else:
        mocker.patch('builtins.open', mock_open)
    assert getmac._read_file('ifconfig.out') == data
    mock_open.assert_called_once_with('ifconfig.out')
Ejemplo n.º 2
0
def test_read_file_not_exist():
    assert getmac._read_file('DOESNOTEXIST') is None