[Tests] Fix AttributeError in test_core with Twisted 19

Should be setting header contents to string not ints and latest version
of Twisted raised an error encountering int. Also correct the header
name for setting length.
This commit is contained in:
Calum Lind 2019-05-03 15:33:02 +01:00
parent 615500e6e6
commit 3c18e890e8

View File

@ -54,7 +54,7 @@ class PartialDownload(Resource):
common.get_test_data_file('ubuntu-9.04-desktop-i386.iso.torrent'), 'rb'
) as _file:
data = _file.read()
request.setHeader(b'Content-Type', len(data))
request.setHeader(b'Content-Length', str(len(data)))
request.setHeader(b'Content-Type', b'application/x-bittorrent')
if request.requestHeaders.hasHeader('accept-encoding'):
return compress(data, request)