mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-01 00:45:52 +00:00
Tests pass on Python 3.
This commit is contained in:
parent
855521fea8
commit
744e205763
@ -1,7 +1,5 @@
|
|||||||
from six import ensure_str
|
from six import ensure_str
|
||||||
|
|
||||||
from types import NoneType
|
|
||||||
|
|
||||||
from zope.interface import implementer
|
from zope.interface import implementer
|
||||||
from twisted.application import service, strports
|
from twisted.application import service, strports
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
@ -264,7 +262,7 @@ class Handler(object):
|
|||||||
d.addCallback(_list)
|
d.addCallback(_list)
|
||||||
def _render(children):
|
def _render(children):
|
||||||
results = []
|
results = []
|
||||||
for (name, childnode) in children.iteritems():
|
for (name, childnode) in children.items():
|
||||||
# the interface claims that the result should have a unicode
|
# the interface claims that the result should have a unicode
|
||||||
# object as the name, but it fails unless you give it a
|
# object as the name, but it fails unless you give it a
|
||||||
# bytestring
|
# bytestring
|
||||||
@ -317,7 +315,7 @@ class Dispatcher(object):
|
|||||||
|
|
||||||
class FTPServer(service.MultiService):
|
class FTPServer(service.MultiService):
|
||||||
def __init__(self, client, accountfile, accounturl, ftp_portstr):
|
def __init__(self, client, accountfile, accounturl, ftp_portstr):
|
||||||
precondition(isinstance(accountfile, (unicode, NoneType)), accountfile)
|
precondition(isinstance(accountfile, (unicode, type(None))), accountfile)
|
||||||
service.MultiService.__init__(self)
|
service.MultiService.__init__(self)
|
||||||
|
|
||||||
r = Dispatcher(client)
|
r = Dispatcher(client)
|
||||||
|
@ -46,7 +46,7 @@ class Handler(GridTestMixin, ReallyEqualMixin, unittest.TestCase):
|
|||||||
|
|
||||||
def _set_up_tree(self):
|
def _set_up_tree(self):
|
||||||
# add immutable file at root
|
# add immutable file at root
|
||||||
immutable = upload.Data("immutable file contents", None)
|
immutable = upload.Data(b"immutable file contents", None)
|
||||||
d = self.root.add_file(u"immutable", immutable)
|
d = self.root.add_file(u"immutable", immutable)
|
||||||
|
|
||||||
# `mtime' and `linkmotime' both set
|
# `mtime' and `linkmotime' both set
|
||||||
@ -62,7 +62,7 @@ class Handler(GridTestMixin, ReallyEqualMixin, unittest.TestCase):
|
|||||||
d.addCallback(lambda _: self._set_metadata(u"loop", md_just_mtime))
|
d.addCallback(lambda _: self._set_metadata(u"loop", md_just_mtime))
|
||||||
|
|
||||||
# add mutable file at root
|
# add mutable file at root
|
||||||
mutable = publish.MutableData("mutable file contents")
|
mutable = publish.MutableData(b"mutable file contents")
|
||||||
d.addCallback(lambda _: self.client.create_mutable_file(mutable))
|
d.addCallback(lambda _: self.client.create_mutable_file(mutable))
|
||||||
d.addCallback(lambda node: self.root.set_node(u"mutable", node))
|
d.addCallback(lambda node: self.root.set_node(u"mutable", node))
|
||||||
|
|
||||||
@ -93,11 +93,11 @@ class Handler(GridTestMixin, ReallyEqualMixin, unittest.TestCase):
|
|||||||
d.addCallback(lambda _: self.handler.list("", keys=keys))
|
d.addCallback(lambda _: self.handler.list("", keys=keys))
|
||||||
|
|
||||||
expected_root = [
|
expected_root = [
|
||||||
('loop',
|
(b'loop',
|
||||||
[0, True, ftpd.IntishPermissions(0o600), 1, self.FALL_OF_BERLIN_WALL, 'alice', 'alice', '??']),
|
[0, True, ftpd.IntishPermissions(0o600), 1, self.FALL_OF_BERLIN_WALL, 'alice', 'alice', '??']),
|
||||||
('immutable',
|
(b'immutable',
|
||||||
[23, False, ftpd.IntishPermissions(0o600), 1, self.TURN_OF_MILLENIUM, 'alice', 'alice', '??']),
|
[23, False, ftpd.IntishPermissions(0o600), 1, self.TURN_OF_MILLENIUM, 'alice', 'alice', '??']),
|
||||||
('mutable',
|
(b'mutable',
|
||||||
# timestamp should be 0 if no timestamp metadata is present
|
# timestamp should be 0 if no timestamp metadata is present
|
||||||
[0, False, ftpd.IntishPermissions(0o600), 1, 0, 'alice', 'alice', '??'])]
|
[0, False, ftpd.IntishPermissions(0o600), 1, 0, 'alice', 'alice', '??'])]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user