Rev4016, Add ad test Python 3.4 compatibility
This commit is contained in:
parent
1da6c8c84e
commit
60405bf222
5 changed files with 10 additions and 4 deletions
|
@ -6,6 +6,7 @@ import collections
|
|||
import math
|
||||
import warnings
|
||||
import base64
|
||||
import binascii
|
||||
|
||||
import gevent
|
||||
import gevent.lock
|
||||
|
@ -66,7 +67,7 @@ class UiRequestPlugin(object):
|
|||
)
|
||||
|
||||
if len(piecemap_info["sha512_pieces"]) == 1: # Small file, don't split
|
||||
hash = piecemap_info["sha512_pieces"][0].hex()
|
||||
hash = binascii.hexlify(piecemap_info["sha512_pieces"][0].encode())
|
||||
hash_id = site.content_manager.hashfield.getHashId(hash)
|
||||
site.content_manager.optionalDownloaded(inner_path, hash_id, upload_info["size"], own=True)
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import time
|
||||
import io
|
||||
import binascii
|
||||
|
||||
import pytest
|
||||
import mock
|
||||
|
@ -39,7 +40,7 @@ class TestBigfile:
|
|||
piecemap = Msgpack.unpack(site.storage.open(file_node["piecemap"], "rb").read())["optional.any.iso"]
|
||||
assert len(piecemap["sha512_pieces"]) == 10
|
||||
assert piecemap["sha512_pieces"][0] != piecemap["sha512_pieces"][1]
|
||||
assert piecemap["sha512_pieces"][0].hex() == "a73abad9992b3d0b672d0c2a292046695d31bebdcb1e150c8410bbe7c972eff3"
|
||||
assert binascii.hexlify(piecemap["sha512_pieces"][0].encode()) == b"a73abad9992b3d0b672d0c2a292046695d31bebdcb1e150c8410bbe7c972eff3"
|
||||
|
||||
def testVerifyPiece(self, site):
|
||||
inner_path = self.createBigfile(site)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue