@@ -0,0 +1,1541 @@
+# This file is part of the Juju GUI, which lets users view and manage Juju%0A# environments within a graphical interface (https://launchpad.net/juju-gui).%0A# Copyright (C) 2013 Canonical Ltd.%0A#%0A# This program is free software: you can redistribute it and/or modify it under%0A# the terms of the GNU Affero General Public License version 3, as published by%0A# the Free Software Foundation.%0A#%0A# This program is distributed in the hope that it will be useful, but WITHOUT%0A# ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,%0A# SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU%0A# Affero General Public License for more details.%0A#%0A# You should have received a copy of the GNU Affero General Public License%0A# along with this program.  If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A%0A%22%22%22Juju GUI server test utilities.%22%22%22%0A%0Afrom tornado import (%0A    web,%0A    websocket,%0A)%0A%0A%0Aclass EchoWebSocketHandler(websocket.WebSocketHandler):%0A    %22%22%22A WebSocket server echoing back messages.%22%22%22%0A%0A    def initialize(self, close_future):%0A        %22%22%22The given future will be fired when the connection is terminated.%22%22%22%0A        self.close_future = close_future%0A%0A    def on_message(self, message):%0A        self.write_message(message, isinstance(message, bytes))%0A%0A    def on_close(self):%0A        self.close_future.set_result('closed')%0A%0A%0Adef echoapp(close_future):%0A    %22%22%22Return an application exposing an EchoWebSocketHandler.%22%22%22%0A    return web.Application(%5B%0A        ('/', EchoWebSocketHandler, dict(close_future=close_future)),%0A    %5D)%0A

Add test helpers.