Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_guess_file_name():
assert_equals(utils.guess_file_name('a/b'), 'b')
assert_equals(utils.guess_file_name('file:///a/b'), 'b')
assert_equals(utils.guess_file_name('A:/a/b'), 'b')
assert_equals(utils.guess_file_name('B:/a/b/'), 'b')
assert_equals(utils.guess_file_name('c:\\a\\b'), 'b')
assert_equals(utils.guess_file_name('d:\\a\\b\\'), 'b')
assert_equals(utils.guess_file_name('E:\\a/b'), 'b')
assert_equals(utils.guess_file_name('F:\\a/b/'), 'b')
assert_equals(utils.guess_file_name('/a/b'), 'b')
assert_equals(utils.guess_file_name('/a/b/'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b/'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar&arga=barga'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar&arga=barga'), 'b')
assert_equals(utils.guess_file_name('a/b'), 'b')
assert_equals(utils.guess_file_name('file:///a/b'), 'b')
assert_equals(utils.guess_file_name('A:/a/b'), 'b')
assert_equals(utils.guess_file_name('B:/a/b/'), 'b')
assert_equals(utils.guess_file_name('c:\\a\\b'), 'b')
assert_equals(utils.guess_file_name('d:\\a\\b\\'), 'b')
assert_equals(utils.guess_file_name('E:\\a/b'), 'b')
assert_equals(utils.guess_file_name('F:\\a/b/'), 'b')
assert_equals(utils.guess_file_name('/a/b'), 'b')
assert_equals(utils.guess_file_name('/a/b/'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b/'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar&arga=barga'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar&arga=barga'), 'b')
def test_guess_file_name():
assert_equals(utils.guess_file_name('a/b'), 'b')
assert_equals(utils.guess_file_name('file:///a/b'), 'b')
assert_equals(utils.guess_file_name('A:/a/b'), 'b')
assert_equals(utils.guess_file_name('B:/a/b/'), 'b')
assert_equals(utils.guess_file_name('c:\\a\\b'), 'b')
assert_equals(utils.guess_file_name('d:\\a\\b\\'), 'b')
assert_equals(utils.guess_file_name('E:\\a/b'), 'b')
assert_equals(utils.guess_file_name('F:\\a/b/'), 'b')
assert_equals(utils.guess_file_name('/a/b'), 'b')
assert_equals(utils.guess_file_name('/a/b/'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b/'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar&arga=barga'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar&arga=barga'), 'b')
def test_guess_file_name():
assert_equals(utils.guess_file_name('a/b'), 'b')
assert_equals(utils.guess_file_name('file:///a/b'), 'b')
assert_equals(utils.guess_file_name('A:/a/b'), 'b')
assert_equals(utils.guess_file_name('B:/a/b/'), 'b')
assert_equals(utils.guess_file_name('c:\\a\\b'), 'b')
assert_equals(utils.guess_file_name('d:\\a\\b\\'), 'b')
assert_equals(utils.guess_file_name('E:\\a/b'), 'b')
assert_equals(utils.guess_file_name('F:\\a/b/'), 'b')
assert_equals(utils.guess_file_name('/a/b'), 'b')
assert_equals(utils.guess_file_name('/a/b/'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b/'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar&arga=barga'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar&arga=barga'), 'b')
def test_guess_file_name():
assert_equals(utils.guess_file_name('a/b'), 'b')
assert_equals(utils.guess_file_name('file:///a/b'), 'b')
assert_equals(utils.guess_file_name('A:/a/b'), 'b')
assert_equals(utils.guess_file_name('B:/a/b/'), 'b')
assert_equals(utils.guess_file_name('c:\\a\\b'), 'b')
assert_equals(utils.guess_file_name('d:\\a\\b\\'), 'b')
assert_equals(utils.guess_file_name('E:\\a/b'), 'b')
assert_equals(utils.guess_file_name('F:\\a/b/'), 'b')
assert_equals(utils.guess_file_name('/a/b'), 'b')
assert_equals(utils.guess_file_name('/a/b/'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b/'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar&arga=barga'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar&arga=barga'), 'b')
def test_guess_file_name():
assert_equals(utils.guess_file_name('a/b'), 'b')
assert_equals(utils.guess_file_name('file:///a/b'), 'b')
assert_equals(utils.guess_file_name('A:/a/b'), 'b')
assert_equals(utils.guess_file_name('B:/a/b/'), 'b')
assert_equals(utils.guess_file_name('c:\\a\\b'), 'b')
assert_equals(utils.guess_file_name('d:\\a\\b\\'), 'b')
assert_equals(utils.guess_file_name('E:\\a/b'), 'b')
assert_equals(utils.guess_file_name('F:\\a/b/'), 'b')
assert_equals(utils.guess_file_name('/a/b'), 'b')
assert_equals(utils.guess_file_name('/a/b/'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b/'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar&arga=barga'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar&arga=barga'), 'b')
def test_guess_file_name():
assert_equals(utils.guess_file_name('a/b'), 'b')
assert_equals(utils.guess_file_name('file:///a/b'), 'b')
assert_equals(utils.guess_file_name('A:/a/b'), 'b')
assert_equals(utils.guess_file_name('B:/a/b/'), 'b')
assert_equals(utils.guess_file_name('c:\\a\\b'), 'b')
assert_equals(utils.guess_file_name('d:\\a\\b\\'), 'b')
assert_equals(utils.guess_file_name('E:\\a/b'), 'b')
assert_equals(utils.guess_file_name('F:\\a/b/'), 'b')
assert_equals(utils.guess_file_name('/a/b'), 'b')
assert_equals(utils.guess_file_name('/a/b/'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b/'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b?foo=bar&arga=barga'), 'b')
assert_equals(utils.guess_file_name('http://www.a.com/b/?foo=bar&arga=barga'), 'b')
def _createChunkedFileUploadToken(self, filepath, mimetype):
"""
This is the first step in uploading a large file. The resulting
ChunkedFileToken will be required for all remaining chunk file requests.
:returns: a `ChunkedFileToken `_
"""
md5 = utils.md5_for_file(filepath).hexdigest()
fileName = utils.guess_file_name(filepath)
return self._createChunkedUploadToken(md5, fileName, mimetype)