'Test that when a LangPack instance is deleted, the corresponding
file on the filesystem is also deleted.'

def test_delete_with_file(self):

    langpack = LangPack.objects.create(version='0.1')
    file_path = langpack.file_path
    with public_storage.open(file_path, 'w') as f:
        f.write('sample    data\n')
    assert public_storage.exists(file_path)
    try:
        langpack.delete()
        assert (not public_storage.exists(file_path))
    finally:
        if public_storage.exists(file_path):
            public_storage.delete(file_path)
