def mock_and_run(self, **kwargs): """Run the application after mocking the IO loop and the options/apps. Additional options can be specified using kwargs. """ options = {"apiversion": "go", "guiroot": "/my/guiroot", "sslpath": "/my/sslpath"} options.update(kwargs) with mock.patch("guiserver.manage.IOLoop") as ioloop, mock.patch( "guiserver.manage.options", mock.Mock(**options) ), mock.patch("guiserver.manage.redirector") as redirector, mock.patch("guiserver.manage.server") as server: manage.run() return ioloop.instance().start, redirector().listen, server().listen
def mock_and_run(self, **kwargs): """Run the application after mocking the IO loop and the options/apps. Additional options can be specified using kwargs. """ options = { 'apiversion': 'go', 'port': None, 'sslpath': '/my/sslpath', } options.update(kwargs) with \ mock.patch('guiserver.manage.IOLoop') as ioloop, \ mock.patch('guiserver.manage.options', mock.Mock(**options)), \ mock.patch('guiserver.manage.redirector') as redirector, \ mock.patch('guiserver.manage.server') as server: manage.run() return ioloop.instance().start, redirector().listen, server().listen
# # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, # SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. """Juju GUI server entry point. Arguments example: --guiroot="/var/lib/juju/agents/unit-juju-gui-0/charm/juju-gui/build-prod" --apiurl="wss://ec2-75-101-177-185.compute-1.example.com:17070" --apiversion="go" --sslpath="/etc/ssl/juju-gui" --tests_root="/var/lib/juju/agents/unit-juju-gui-0/charm/juju-gui/test/" --insecure --sandbox --logging=debug|info|warning|error --charmworldurl="https://manage.jujucharms.com/" The --sslpath option is ignored if --insecure is set. The --apiurl and --apiversion options are ignored if --sandbox is set. """ from guiserver import manage if __name__ == '__main__': manage.setup() manage.run()
# ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, # SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. """Juju GUI server entry point. Arguments example: --guiroot="/var/lib/juju/agents/unit-juju-gui-0/charm/juju-gui/build-prod" --apiurl="wss://ec2-75-101-177-185.compute-1.example.com:17070" --apiversion="go" --sslpath="/etc/ssl/juju-gui" --tests_root="/var/lib/juju/agents/unit-juju-gui-0/charm/juju-gui/test/" --insecure --sandbox --logging=debug|info|warning|error --charmworldurl="https://manage.jujucharms.com/" The --sslpath option is ignored if --insecure is set. The --apiurl and --apiversion options are ignored if --sandbox is set. """ from guiserver import manage if __name__ == '__main__': manage.setup() manage.run()