Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1424)

Side by Side Diff: tests/20-functional.test

Issue 71230043: Constraint parsing from charmworldlib.
Patch Set: Constraint parsing from charmworldlib. Created 10 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « server/guiserver/tests/bundles/test_utils.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!tests/.venv/bin/python 1 #!tests/.venv/bin/python
2 2
3 # This file is part of the Juju GUI, which lets users view and manage Juju 3 # This file is part of the Juju GUI, which lets users view and manage Juju
4 # environments within a graphical interface (https://launchpad.net/juju-gui). 4 # environments within a graphical interface (https://launchpad.net/juju-gui).
5 # Copyright (C) 2012-2013 Canonical Ltd. 5 # Copyright (C) 2012-2013 Canonical Ltd.
6 # 6 #
7 # This program is free software: you can redistribute it and/or modify it under 7 # This program is free software: you can redistribute it and/or modify it under
8 # the terms of the GNU Affero General Public License version 3, as published by 8 # the terms of the GNU Affero General Public License version 3, as published by
9 # the Free Software Foundation. 9 # the Free Software Foundation.
10 # 10 #
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 port = '443' 79 port = '443'
80 80
81 def setUp(self): 81 def setUp(self):
82 # Perform all graphical operations in memory. 82 # Perform all graphical operations in memory.
83 vdisplay = Xvfb(width=1280, height=720) 83 vdisplay = Xvfb(width=1280, height=720)
84 vdisplay.start() 84 vdisplay.start()
85 self.addCleanup(vdisplay.stop) 85 self.addCleanup(vdisplay.stop)
86 # Create a Selenium browser instance. 86 # Create a Selenium browser instance.
87 selenium = self.selenium = Firefox() 87 selenium = self.selenium = Firefox()
88 self.addCleanup(selenium.quit) 88 self.addCleanup(selenium.quit)
89 self.service_name = None
89 super(DeployTestMixin, self).setUp() 90 super(DeployTestMixin, self).setUp()
90 91
91 def assertEnvironmentIsConnected(self): 92 def assertEnvironmentIsConnected(self):
92 """Assert the GUI environment is connected to the Juju API agent.""" 93 """Assert the GUI environment is connected to the Juju API agent."""
93 self.wait_for_script( 94 self.wait_for_script(
94 'return app && app.env && app.env.get("connected");', 95 'return app && app.env && app.env.get("connected");',
95 error='Environment not connected.') 96 error='Environment not connected.')
96 97
97 def handle_browser_warning(self): 98 def handle_browser_warning(self):
98 """Overstep the browser warning dialog if required.""" 99 """Overstep the browser warning dialog if required."""
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 """Return a dictionary of info as exposed by the builtin server.""" 164 """Return a dictionary of info as exposed by the builtin server."""
164 url = 'https://{}/gui-server-info'.format(hostname) 165 url = 'https://{}/gui-server-info'.format(hostname)
165 response = urllib2.urlopen(url) 166 response = urllib2.urlopen(url)
166 self.assertEqual(200, response.code) 167 self.assertEqual(200, response.code)
167 return json.load(response) 168 return json.load(response)
168 169
169 170
170 class TestDeployOptions(DeployTestMixin, unittest.TestCase): 171 class TestDeployOptions(DeployTestMixin, unittest.TestCase):
171 172
172 def tearDown(self): 173 def tearDown(self):
173 juju_destroy_service(self.service_name) 174 if self.service_name is not None:
175 juju_destroy_service(self.service_name)
174 176
175 def test_stable_release(self): 177 def test_stable_release(self):
176 # Ensure the stable Juju GUI release is correctly set up. 178 # Ensure the stable Juju GUI release is correctly set up.
177 self.service_name, unit_info, _ = juju_deploy_gui( 179 self.service_name, unit_info, _ = juju_deploy_gui(
178 options={'juju-gui-source': 'stable'}) 180 options={'juju-gui-source': 'stable'})
179 hostname = unit_info['public-address'] 181 hostname = unit_info['public-address']
180 self.navigate_to(hostname) 182 self.navigate_to(hostname)
181 self.handle_browser_warning() 183 self.handle_browser_warning()
182 self.assertEnvironmentIsConnected() 184 self.assertEnvironmentIsConnected()
183 185
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 # Make sure the check-app-access.sh script's ADDRESS is available. 442 # Make sure the check-app-access.sh script's ADDRESS is available.
441 conn = httplib.HTTPSConnection(self.hostname) 443 conn = httplib.HTTPSConnection(self.hostname)
442 # This request matches the ADDRESS var in the script. 444 # This request matches the ADDRESS var in the script.
443 conn.request('GET', '/juju-ui/version.js') 445 conn.request('GET', '/juju-ui/version.js')
444 message = 'ADDRESS in check-app-access.sh is not accessible.' 446 message = 'ADDRESS in check-app-access.sh is not accessible.'
445 self.assertEqual(200, conn.getresponse().status, message) 447 self.assertEqual(200, conn.getresponse().status, message)
446 448
447 449
448 if __name__ == '__main__': 450 if __name__ == '__main__':
449 unittest.main(verbosity=2) 451 unittest.main(verbosity=2)
OLDNEW
« no previous file with comments | « server/guiserver/tests/bundles/test_utils.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b