util.config.validators: fix torrent validation
This code was mistaken the info dict with the params passed in an announce request. Rather, now we expose a function for creating a jwt from infohashes directly.
This commit is contained in:
parent
6321d08024
commit
7d07c2ed07
2 changed files with 20 additions and 13 deletions
|
@ -4,7 +4,7 @@ from hashlib import sha1
|
|||
|
||||
from app import app
|
||||
from util.config.validators import BaseValidator, ConfigValidationException
|
||||
from util.registry.torrent import torrent_jwt
|
||||
from util.registry.torrent import jwt_from_infohash
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -22,7 +22,7 @@ class BittorrentValidator(BaseValidator):
|
|||
client = app.config['HTTPCLIENT']
|
||||
|
||||
params = {
|
||||
'info_hash': sha1('somedata').digest(),
|
||||
'info_hash': sha1('test').digest(),
|
||||
'peer_id': '-QUAY00-6wfG2wk6wWLc',
|
||||
'uploaded': 0,
|
||||
'downloaded': 0,
|
||||
|
@ -31,7 +31,7 @@ class BittorrentValidator(BaseValidator):
|
|||
'port': 80,
|
||||
}
|
||||
|
||||
encoded_jwt = torrent_jwt(params)
|
||||
encoded_jwt = jwt_from_infohash(params['info_hash'])
|
||||
params['jwt'] = encoded_jwt
|
||||
|
||||
resp = client.get(announce_url, timeout=5, params=params)
|
||||
|
|
Reference in a new issue