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
|
@ -2,6 +2,9 @@ language: python
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
- python: 3.4
|
||||||
|
dist: trusty
|
||||||
|
sudo: false
|
||||||
- python: 3.5
|
- python: 3.5
|
||||||
dist: trusty
|
dist: trusty
|
||||||
sudo: false
|
sudo: false
|
||||||
|
|
|
@ -6,6 +6,7 @@ import collections
|
||||||
import math
|
import math
|
||||||
import warnings
|
import warnings
|
||||||
import base64
|
import base64
|
||||||
|
import binascii
|
||||||
|
|
||||||
import gevent
|
import gevent
|
||||||
import gevent.lock
|
import gevent.lock
|
||||||
|
@ -66,7 +67,7 @@ class UiRequestPlugin(object):
|
||||||
)
|
)
|
||||||
|
|
||||||
if len(piecemap_info["sha512_pieces"]) == 1: # Small file, don't split
|
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)
|
hash_id = site.content_manager.hashfield.getHashId(hash)
|
||||||
site.content_manager.optionalDownloaded(inner_path, hash_id, upload_info["size"], own=True)
|
site.content_manager.optionalDownloaded(inner_path, hash_id, upload_info["size"], own=True)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import time
|
import time
|
||||||
import io
|
import io
|
||||||
|
import binascii
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import mock
|
import mock
|
||||||
|
@ -39,7 +40,7 @@ class TestBigfile:
|
||||||
piecemap = Msgpack.unpack(site.storage.open(file_node["piecemap"], "rb").read())["optional.any.iso"]
|
piecemap = Msgpack.unpack(site.storage.open(file_node["piecemap"], "rb").read())["optional.any.iso"]
|
||||||
assert len(piecemap["sha512_pieces"]) == 10
|
assert len(piecemap["sha512_pieces"]) == 10
|
||||||
assert piecemap["sha512_pieces"][0] != piecemap["sha512_pieces"][1]
|
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):
|
def testVerifyPiece(self, site):
|
||||||
inner_path = self.createBigfile(site)
|
inner_path = self.createBigfile(site)
|
||||||
|
|
|
@ -13,7 +13,7 @@ class Config(object):
|
||||||
|
|
||||||
def __init__(self, argv):
|
def __init__(self, argv):
|
||||||
self.version = "0.7.0"
|
self.version = "0.7.0"
|
||||||
self.rev = 4015
|
self.rev = 4016
|
||||||
self.argv = argv
|
self.argv = argv
|
||||||
self.action = None
|
self.action = None
|
||||||
self.pending_changes = {}
|
self.pending_changes = {}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import logging
|
import logging
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
|
import binascii
|
||||||
|
|
||||||
import gevent
|
import gevent
|
||||||
|
|
||||||
|
@ -53,7 +54,7 @@ class User(object):
|
||||||
self.delayed_save_thread = gevent.spawn_later(5, self.save)
|
self.delayed_save_thread = gevent.spawn_later(5, self.save)
|
||||||
|
|
||||||
def getAddressAuthIndex(self, address):
|
def getAddressAuthIndex(self, address):
|
||||||
return int(address.encode("ascii").hex(), 16)
|
return int(binascii.hexlify(address.encode()), 16)
|
||||||
|
|
||||||
@util.Noparallel()
|
@util.Noparallel()
|
||||||
def generateAuthAddress(self, address):
|
def generateAuthAddress(self, address):
|
||||||
|
|
Loading…
Reference in a new issue