Пример #1
0
    def test_verbose_url(self):
        project = ProjectFactory()
        file_obj = DropboxFile(node=project, path='foo.txt')
        file_obj.save()
        file_url = file_obj.url(guid=False)

        url = web_url_for('dropbox_view_file',
            pid=project._primary_key, path=file_obj.path, rev='')
        assert_equal(url, file_url)
Пример #2
0
    def test_cache_file_name_encode(self):
        project = ProjectFactory()
        path = 'à/ é éà'
        file_obj = DropboxFile(node=project, path=path)
        mock_client = MockDropbox()
        file_obj.update_metadata(client=mock_client)
        file_obj.save()

        result = file_obj.get_cache_filename(client=mock_client)
        assert_equal(
            result, '{0}_{1}.html'.format(
                hashlib.md5(path).hexdigest(),
                file_obj.metadata['rev'],
            ))