(mock_get, mock_socket)
| 51 | @patch('sshuttle.sdnotify.socket.socket') |
| 52 | @patch('sshuttle.sdnotify.os.environ.get') |
| 53 | def test_notify(mock_get, mock_socket): |
| 54 | messages = [sshuttle.sdnotify.ready(), sshuttle.sdnotify.status('Running')] |
| 55 | socket_path = '/run/valid_path' |
| 56 | |
| 57 | sock = Mock() |
| 58 | sock.sendto.return_value = 1 |
| 59 | mock_get.return_value = '/run/valid_path' |
| 60 | mock_socket.return_value = sock |
| 61 | |
| 62 | assert sshuttle.sdnotify.send(*messages) |
| 63 | assert sock.sendto.mock_calls == [ |
| 64 | call(b'\n'.join(messages), socket_path), |
| 65 | ] |