示例#1
0
    def test_reconnect_not_connected(self):
        conn = Connection()

        conn.open = Mock()
        conn.close = Mock()
        conn.is_connected = Mock()
        conn.is_connected.return_value = False

        conn.reconnect()
        ok_(not conn.close.called)
        conn.open.assert_called_once_with()
示例#2
0
    def test_reconnect(self):
        conn = Connection()

        conn.open = Mock()
        conn.close = Mock()
        conn.is_connected = Mock()
        conn.is_connected.return_value = True

        conn.reconnect()
        conn.close.assert_called_once_with()
        conn.open.assert_called_once_with()