Example #1
0
def test_node_chmod(mock_chmod, mock_path_exists, atts, expected):
    """Tests Node's chmod method."""
    mock_path_exists.return_value = True # Assume this is working for this test
    node = Node(atts)
    assert expected == node.chmod()
    if atts['path'] and node.perms:
        mock_chmod.assert_called_once_with(atts['path'], atts['perms'])
    else:
        assert not mock_chmod.called
Example #2
0
def test_node_chmod_nonexisting(mock_path_exists):
    """Tests Node's chown method with a nonexisting node."""
    mock_path_exists.return_value = False
    node = Node(DEFUALT_ATTS)
    with pytest.raises(IOError):
        node.chmod()