Tests pass on Python 3.

This commit is contained in:
Itamar Turner-Trauring 2021-05-03 11:13:27 -04:00
parent 2b751c44db
commit 9dcfa2171e
2 changed files with 7 additions and 4 deletions

View File

@ -1,5 +1,7 @@
from __future__ import print_function
from past.builtins import unicode
import re
from urllib.parse import quote as url_quote
import json
@ -47,6 +49,7 @@ def mv(options, mode="move"):
if path:
to_url += "/" + escape_path(path)
from_path = unicode(from_path, "utf-8")
if to_url.endswith("/"):
# "mv foo.txt bar/" == "mv foo.txt bar/foo.txt"
to_url += escape_path(from_path[from_path.rfind("/")+1:])

View File

@ -10,10 +10,10 @@ class Mv(GridTestMixin, CLITestMixin, unittest.TestCase):
self.basedir = "cli/Mv/mv_behavior"
self.set_up_grid(oneshare=True)
fn1 = os.path.join(self.basedir, "file1")
DATA1 = "Nuclear launch codes"
DATA1 = b"Nuclear launch codes"
fileutil.write(fn1, DATA1)
fn2 = os.path.join(self.basedir, "file2")
DATA2 = "UML diagrams"
DATA2 = b"UML diagrams"
fileutil.write(fn2, DATA2)
# copy both files to the grid
d = self.do_cli("create-alias", "tahoe")
@ -104,11 +104,11 @@ class Mv(GridTestMixin, CLITestMixin, unittest.TestCase):
self.basedir = "cli/Mv/mv_error_if_DELETE_fails"
self.set_up_grid(oneshare=True)
fn1 = os.path.join(self.basedir, "file1")
DATA1 = "Nuclear launch codes"
DATA1 = b"Nuclear launch codes"
fileutil.write(fn1, DATA1)
original_do_http = tahoe_mv.do_http
def mock_do_http(method, url, body=""):
def mock_do_http(method, url, body=b""):
if method == "DELETE":
class FakeResponse(object):
def read(self):