1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#!/usr/bin/env python
# Ubuntu Continuous Integration Engine
# Copyright 2014 Canonical Ltd.
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License version 3, as
# published by the Free Software Foundation.
# 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/>.
import json
import httplib2
import unittest
import deployers
class WebUITest(deployers.DeployerTest):
"""Integration tests for ticket-system service run on a juju deployment"""
def get_server_status_and_content(self, url):
final_url = url.format(
self.get_ip_and_port('ci-airline-webui-apache')[0])
# Issue a simple command against the ticket API
client = httplib2.Http()
return client.request(final_url, 'GET')
def test_index(self):
'''show we can load our front page.'''
url = 'http://{}/'
self.get_ip_and_port('ci-airline-webui-apache')
resp, content = self.get_server_status_and_content(url)
self.assertEqual('200', resp['status'])
def test_json_status(self):
'''Ensure the webui charm is providing us a valid status_urls.json'''
url = 'http://{}/static/engine-health/status_urls.json'
self.get_ip_and_port('ci-airline-webui-apache')
resp, content = self.get_server_status_and_content(url)
self.assertEqual('200', resp['status'])
json.loads(content)
def test_status_page(self):
'''show we can load our front page.'''
url = 'http://{}/status/'
self.get_ip_and_port('ci-airline-webui-apache')
resp, content = self.get_server_status_and_content(url)
self.assertEqual('200', resp['status'])
self.assertIn('href="/status/" class="active">Engine health', content)
if __name__ == "__main__":
unittest.main()
|