Skip to content

Commit 50c5edc

Browse files
committed
Adjusted test_lineprotocol() for binary responses
1 parent 10a74a1 commit 50c5edc

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/network/test_lineprotocol.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -211,19 +211,18 @@ def test_send_lines_calls_join_lines(self):
211211
self.mock.connection = Mock(spec=network.Connection)
212212
self.mock.join_lines.return_value = "lines"
213213

214-
network.LineProtocol.send_lines(self.mock, ["line 1", "line 2"])
215-
self.mock.join_lines.assert_called_once_with(["line 1", "line 2"])
214+
network.LineProtocol.send_lines(self.mock, ["line 1".encode(), "line 2".encode()])
215+
self.mock.join_lines.assert_called_once_with(["line 1".encode(), "line 2".encode()])
216216

217217
def test_send_line_encodes_joined_lines_with_final_terminator(self):
218218
self.mock.connection = Mock(spec=network.Connection)
219-
self.mock.join_lines.return_value = "lines\n"
220219

221-
network.LineProtocol.send_lines(self.mock, ["line 1", "line 2"])
222-
self.mock.encode.assert_called_once_with("lines\n")
220+
network.LineProtocol.send_lines(self.mock, ["line 1"])
221+
self.mock.encode.assert_called_once_with("line 1")
223222

224223
def test_send_lines_sends_encoded_string(self):
225224
self.mock.connection = Mock(spec=network.Connection)
226-
self.mock.join_lines.return_value = "lines"
225+
self.mock.join_lines.return_value = sentinel.data
227226
self.mock.encode.return_value = sentinel.data
228227

229228
network.LineProtocol.send_lines(self.mock, ["line 1", "line 2"])
@@ -234,9 +233,10 @@ def test_join_lines_returns_empty_string_for_no_lines(self):
234233

235234
def test_join_lines_returns_joined_lines(self):
236235
self.mock.decode.return_value = "\n"
237-
assert "1\n2\n" == network.LineProtocol.join_lines(
238-
self.mock, ["1", "2"]
236+
result = network.LineProtocol.join_lines(
237+
self.mock, ["1".encode(), "2".encode()]
239238
)
239+
assert "1\n2\n".encode() == result
240240

241241
def test_decode_calls_decode_on_string(self):
242242
string = Mock()

0 commit comments

Comments
 (0)