mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-19 11:16:24 +00:00
More progress towards Python 3.
This commit is contained in:
parent
b7d6b97f63
commit
919930173e
@ -1,8 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import mock
|
import mock
|
||||||
import json
|
|
||||||
import tempfile
|
import tempfile
|
||||||
from six.moves import StringIO
|
from io import BytesIO, StringIO
|
||||||
from os.path import join
|
from os.path import join
|
||||||
|
|
||||||
from twisted.trial import unittest
|
from twisted.trial import unittest
|
||||||
@ -21,6 +20,7 @@ from allmydata.immutable.downloader.status import DownloadStatus
|
|||||||
from allmydata.mutable.publish import PublishStatus
|
from allmydata.mutable.publish import PublishStatus
|
||||||
from allmydata.mutable.retrieve import RetrieveStatus
|
from allmydata.mutable.retrieve import RetrieveStatus
|
||||||
from allmydata.mutable.servermap import UpdateStatus
|
from allmydata.mutable.servermap import UpdateStatus
|
||||||
|
from allmydata.util import jsonbytes as json
|
||||||
|
|
||||||
from ..no_network import GridTestMixin
|
from ..no_network import GridTestMixin
|
||||||
from ..common_web import do_http
|
from ..common_web import do_http
|
||||||
@ -84,7 +84,7 @@ class Integration(GridTestMixin, CLITestMixin, unittest.TestCase):
|
|||||||
|
|
||||||
# upload something
|
# upload something
|
||||||
c0 = self.g.clients[0]
|
c0 = self.g.clients[0]
|
||||||
data = MutableData("data" * 100)
|
data = MutableData(b"data" * 100)
|
||||||
filenode = yield c0.create_mutable_file(data)
|
filenode = yield c0.create_mutable_file(data)
|
||||||
self.uri = filenode.get_uri()
|
self.uri = filenode.get_uri()
|
||||||
|
|
||||||
@ -143,14 +143,14 @@ class CommandStatus(unittest.TestCase):
|
|||||||
def test_simple(self, http):
|
def test_simple(self, http):
|
||||||
recent_items = active_items = [
|
recent_items = active_items = [
|
||||||
UploadStatus(),
|
UploadStatus(),
|
||||||
DownloadStatus("abcd", 12345),
|
DownloadStatus(b"abcd", 12345),
|
||||||
PublishStatus(),
|
PublishStatus(),
|
||||||
RetrieveStatus(),
|
RetrieveStatus(),
|
||||||
UpdateStatus(),
|
UpdateStatus(),
|
||||||
FakeStatus(),
|
FakeStatus(),
|
||||||
]
|
]
|
||||||
values = [
|
values = [
|
||||||
StringIO(json.dumps({
|
BytesIO(json.dumps({
|
||||||
"active": list(
|
"active": list(
|
||||||
marshal_json(item)
|
marshal_json(item)
|
||||||
for item
|
for item
|
||||||
@ -161,15 +161,15 @@ class CommandStatus(unittest.TestCase):
|
|||||||
for item
|
for item
|
||||||
in recent_items
|
in recent_items
|
||||||
),
|
),
|
||||||
})),
|
}).encode("utf-8")),
|
||||||
StringIO(json.dumps({
|
BytesIO(json.dumps({
|
||||||
"counters": {
|
"counters": {
|
||||||
"bytes_downloaded": 0,
|
"bytes_downloaded": 0,
|
||||||
},
|
},
|
||||||
"stats": {
|
"stats": {
|
||||||
"node.uptime": 0,
|
"node.uptime": 0,
|
||||||
}
|
}
|
||||||
})),
|
}).encode("utf-8")),
|
||||||
]
|
]
|
||||||
http.side_effect = lambda *args, **kw: values.pop(0)
|
http.side_effect = lambda *args, **kw: values.pop(0)
|
||||||
do_status(self.options)
|
do_status(self.options)
|
||||||
|
Loading…
Reference in New Issue
Block a user