def test_sets_connection_flag_to_false(self, monkeypatch):

        mocked_socket = MagicMock()
        conn = Connection()
        monkeypatch.setattr(conn, "socket", mocked_socket)

        conn.is_connected = True
        conn.disconnect()

        assert conn.is_connected == False
    def test_closes_socket(self, monkeypatch):

        mocked_socket = MagicMock()
        mock_close = MagicMock()
        mocked_socket.close = mock_close
        conn = Connection()
        monkeypatch.setattr(conn, "socket", mocked_socket)

        conn.disconnect()

        mock_close.assert_called_once()