Beispiel #1
0
    def test_close(self, mock_socket):
        conn = TcpConnection('localhost', 2000)
        conn.open()
        conn.close()

        conn.socket.close.assert_called_once_with()
        ok_(not conn.is_connected())
Beispiel #2
0
    def test_open(self, mock_socket):
        conn = TcpConnection('localhost', 2000)
        conn.open()
        conn.socket.connect.assert_called_once_with(('localhost', 2000))

        ok_(conn.is_connected())