Exemplo n.º 1
0
def test_list_files_in_default_storage_cached():
    # import pdb; pdb.set_trace()
    with isolate_lru_cache(list_files_in_default_storage):
        with patch('stagesetting.utils._get_files_in_default_storage') as is_called:
            for x in range(0, 6):
                list_files_in_default_storage()
            is_called.assert_called_once_with()
Exemplo n.º 2
0
def test_list_files_in_default_storage_partial():
    found = tuple(list_files_in_default_storage(only_matching='\.txt$'))
    found2 = tuple(list_files_in_default_storage(only_matching='\.txt$'))
    # make sure they're the same.
    assert found == found2
    assert len(found) == 1
    assert found[0][0] == 'static'
    assert found[0][1] == (('static/file_found_1.txt', 'file_found_1.txt'),
                           ('static/subdir/file_found_2.txt', 'subdir/file_found_2.txt'))
Exemplo n.º 3
0
def test_list_files_in_default_storage():
    found = tuple(list_files_in_default_storage())
    found2 = tuple(list_files_in_default_storage())
    # make sure they're the same.
    assert found == found2
    assert found[0][0] == 'None'
    # Using negative indexes because py3k leaves __pycache__ folders behind
    # which break the numbering on Py2.
    assert found[-2][0] == 'static'
    assert found[-1][0] == 'templates'
    assert found[-2][1] == (('static/file_found_1.txt', 'file_found_1.txt'),
                           ('static/subdir/file_found_2.txt', 'subdir/file_found_2.txt'))
    assert found[-1][1] == (('templates/base.html', 'base.html'),
                            ('templates/example_usage.html', 'example_usage.html'))