Skip to content

Commit 085d2d4

Browse files
committed
Add chunking for messeages over 512 bytes (#15)
1 parent f1f8689 commit 085d2d4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/Modem/test_Modem.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ def no_serial_port(monkeypatch):
5757
def get_sms(monkeypatch):
5858
monkeypatch.setattr(Modem, 'command', mock_command_sms)
5959
monkeypatch.setattr(Modem, 'set', mock_set_sms)
60+
def override_command_result(monkeypatch):
61+
monkeypatch.setattr(Modem, '_command_result', mock_result)
6062

6163
@pytest.fixture
6264
def override_command_result(monkeypatch):
@@ -103,6 +105,18 @@ def test_get_sms(no_serial_port, get_sms):
103105
assert(res.timestamp == datetime.utcfromtimestamp(1498264009))
104106
assert(res.message == 'Test 123')
105107

108+
# WRITE SOCKET
109+
110+
def test_socket_write_under_512(no_serial_port, override_command_result):
111+
modem = Modem()
112+
data = '{message:{fill}{align}{width}}'.format(message='Test-', fill='@', align='<', width=64)
113+
modem.write_socket(data.encode())
114+
115+
def test_socket_write_over_512(no_serial_port, override_command_result):
116+
modem = Modem()
117+
data = '{message:{fill}{align}{width}}'.format(message='Test-', fill='@', align='<', width=600)
118+
modem.write_socket(data.encode())
119+
106120
# DEBUGWRITE
107121

108122
def test_debugwrite(no_serial_port):

0 commit comments

Comments
 (0)