| 34 | @patch('sshuttle.sdnotify.socket.socket') |
| 35 | @patch('sshuttle.sdnotify.os.environ.get') |
| 36 | def test_notify_sendto_error(mock_get, mock_socket): |
| 37 | message = sshuttle.sdnotify.ready() |
| 38 | socket_path = '/run/valid_path' |
| 39 | |
| 40 | sock = Mock() |
| 41 | sock.sendto.side_effect = socket.error('test error') |
| 42 | mock_get.return_value = '/run/valid_path' |
| 43 | mock_socket.return_value = sock |
| 44 | |
| 45 | assert not sshuttle.sdnotify.send(message) |
| 46 | assert sock.sendto.mock_calls == [ |
| 47 | call(message, socket_path), |
| 48 | ] |
| 49 | |
| 50 | |
| 51 | @patch('sshuttle.sdnotify.socket.socket') |