# Path: invenio_files_rest/cli.py
# @click.group()
# def files():
#     """File management commands."""


import os
from click.testing import CliRunner
from flask.cli import ScriptInfo
from invenio_files_rest.cli import files as cmd

    created_locations = result.output.split('\n')
    # tmp is default
    assert "tmp" in created_locations[0]
    assert "as default True" in created_locations[0]
    # aux is not default
    assert "aux" in created_locations[1]
    assert "as default False" in created_locations[1]

    ##
    # Buckets
    ##

    result = runner.invoke(cmd, ['bucket', 'touch'], obj=script_info)
    assert 0 == result.exit_code
    bucket_id = result.output.split('\n')[0]

    # Specify a directory where 2 files have same content.
    result = runner.invoke(cmd, [
        'bucket', 'cp', source, bucket_id, '--checksum'
    ], obj=script_info)
    assert 0 == result.exit_code

    # Specify a file.
    result = runner.invoke(cmd, ['bucket', 'cp', __file__, bucket_id],
                           obj=script_info)
    assert 0 == result.exit_code
    prev_num_files = len(tmpdir.listdir())

    # No new file should be created.

# Path: invenio_files_rest/cli.py
# @click.group()
# def files():
#     """File management commands."""


# Path: tests/test_cli.py
import os
from click.testing import CliRunner
from flask.cli import ScriptInfo
from invenio_files_rest.cli import files as cmd


    created_locations = result.output.split('\n')
    # tmp is default
    assert "tmp" in created_locations[0]
    assert "as default True" in created_locations[0]
    # aux is not default
    assert "aux" in created_locations[1]
    assert "as default False" in created_locations[1]

    ##
    # Buckets
    ##

    result = runner.invoke(cmd, ['bucket', 'touch'], obj=script_info)
    assert 0 == result.exit_code
    bucket_id = result.output.split('\n')[0]

    # Specify a directory where 2 files have same content.
    result = runner.invoke(cmd, [
        'bucket', 'cp', source, bucket_id, '--checksum'
    ], obj=script_info)
    assert 0 == result.exit_code

    # Specify a file.
    result = runner.invoke(cmd, ['bucket', 'cp', __file__, bucket_id],
                           obj=script_info)
    assert 0 == result.exit_code
    prev_num_files = len(tmpdir.listdir())

    # No new file should be created.

    result = runner.invoke(cmd, [