Beispiel #1
0
def test_empty_file_has_correct_permissions():

    from fabtools.files import owner, group, mode
    from fabtools.require.files import file as require_file

    try:
        run_as_root('touch foo')
        require_file('bar', use_sudo=True)

        assert owner('foo') == owner('bar')
        assert group('foo') == group('bar')
        assert mode('foo') == mode('bar')

    finally:
        run_as_root('rm -f foo bar')
Beispiel #2
0
def test_permissions():

    from fabtools.files import owner, group, mode
    from fabtools.require.files import directory as require_directory

    try:
        run_as_root('mkdir foo')
        require_directory('bar', use_sudo=True)

        assert owner('foo') == owner('bar')
        assert group('foo') == group('bar')
        assert mode('foo') == mode('bar')

    finally:
        run_as_root('rmdir foo bar')
Beispiel #3
0
def test_file_with_contents_has_correct_permissions():

    from fabtools.files import owner, group, mode
    from fabtools.require.files import file as require_file

    try:
        run_as_root('echo "something" > foo')
        require_file('bar', contents='something', use_sudo=True)

        assert owner('foo') == owner('bar')
        assert group('foo') == group('bar')
        assert mode('foo') == mode('bar')

    finally:
        run_as_root('rm -f foo bar')
Beispiel #4
0
def test_empty_file_has_correct_permissions():

    from fabtools.files import owner, group, mode
    from fabtools.require.files import file as require_file

    try:
        run_as_root('touch foo')
        require_file('bar', use_sudo=True)

        assert owner('foo') == owner('bar')
        assert group('foo') == group('bar')
        assert mode('foo') == mode('bar')

    finally:
        run_as_root('rm -f foo bar')
Beispiel #5
0
def test_permissions():

    from fabtools.files import owner, group, mode
    from fabtools.require.files import directory as require_directory

    try:
        run_as_root('mkdir foo')
        require_directory('bar', use_sudo=True)

        assert owner('foo') == owner('bar')
        assert group('foo') == group('bar')
        assert mode('foo') == mode('bar')

    finally:
        run_as_root('rmdir foo bar')
Beispiel #6
0
def test_file_with_contents_has_correct_permissions():

    from fabtools.files import owner, group, mode
    from fabtools.require.files import file as require_file

    try:
        run_as_root('echo "something" > foo')
        require_file('bar', contents='something', use_sudo=True)

        assert owner('foo') == owner('bar')
        assert group('foo') == group('bar')
        assert mode('foo') == mode('bar')

    finally:
        run_as_root('rm -f foo bar')