Pass bytes to tempfile.NamedTemporaryFile().write()
This method takes bytes as input; the current code fails in Python 3. Closes-Bug: #1281372 Change-Id: I070d9e9e07523c124f3168b55048fb9d1b338f69
This commit is contained in:
parent
b8a850c5b3
commit
fe006e0671
|
@ -201,7 +201,7 @@ class TestClient(testtools.TestCase):
|
|||
|
||||
def test_raw_request_no_content_length(self):
|
||||
with tempfile.NamedTemporaryFile() as test_file:
|
||||
test_file.write('abcd')
|
||||
test_file.write(b'abcd')
|
||||
test_file.seek(0)
|
||||
data_length = 4
|
||||
self.assertEqual(client_utils.get_file_size(test_file),
|
||||
|
@ -233,7 +233,7 @@ class TestClient(testtools.TestCase):
|
|||
|
||||
def test_raw_request_w_content_length(self):
|
||||
with tempfile.NamedTemporaryFile() as test_file:
|
||||
test_file.write('abcd')
|
||||
test_file.write(b'abcd')
|
||||
test_file.seek(0)
|
||||
data_length = 4
|
||||
self.assertEqual(client_utils.get_file_size(test_file),
|
||||
|
@ -267,7 +267,7 @@ class TestClient(testtools.TestCase):
|
|||
|
||||
def test_raw_request_w_bad_content_length(self):
|
||||
with tempfile.NamedTemporaryFile() as test_file:
|
||||
test_file.write('abcd')
|
||||
test_file.write(b'abcd')
|
||||
test_file.seek(0)
|
||||
self.assertEqual(client_utils.get_file_size(test_file), 4)
|
||||
|
||||
|
|
Loading…
Reference in New Issue