@@ -57,6 +57,8 @@ def no_serial_port(monkeypatch):
57
57
def get_sms (monkeypatch ):
58
58
monkeypatch .setattr (Modem , 'command' , mock_command_sms )
59
59
monkeypatch .setattr (Modem , 'set' , mock_set_sms )
60
+ def override_command_result (monkeypatch ):
61
+ monkeypatch .setattr (Modem , '_command_result' , mock_result )
60
62
61
63
@pytest .fixture
62
64
def override_command_result (monkeypatch ):
@@ -103,6 +105,18 @@ def test_get_sms(no_serial_port, get_sms):
103
105
assert (res .timestamp == datetime .utcfromtimestamp (1498264009 ))
104
106
assert (res .message == 'Test 123' )
105
107
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
+
106
120
# DEBUGWRITE
107
121
108
122
def test_debugwrite (no_serial_port ):
0 commit comments