-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathopenshift-app-tester
More file actions
executable file
·197 lines (143 loc) · 5.26 KB
/
Copy pathopenshift-app-tester
File metadata and controls
executable file
·197 lines (143 loc) · 5.26 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#!/usr/bin/env python
# OpenShift Quickstarter Test Suite
#
# Copyright (C) 2011 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Author: Luke Macken <lmacken@redhat.com>
import os
import shutil
import getpass
import unittest
import pexpect
login = None
password = None
domain = None
timeout = 600
class OpenShiftQuickstartTest(object):
app = None
title = None
db = True
index = '/'
def setUp(self):
self._create_app()
self.html = self.get(self.index)
def tearDown(self):
self._destroy_app()
def _create_app(self):
cmd = ['./openshift-quickstarter', login, domain, self.app, self.app]
child = pexpect.spawn(' '.join(cmd), timeout=timeout)
child.expect('Password:')
child.sendline(password)
if self.db:
child.expect('Password:')
child.sendline(password)
child.expect(pexpect.EOF)
def _destroy_app(self):
if os.path.isdir(self.app):
shutil.rmtree(self.app)
child = pexpect.spawn('rhc-ctl-app -l %s -c destroy -a %s' % (
login, self.app), timeout=timeout)
child.expect('Password:')
child.sendline(password)
child.expect('Do you want to destroy this application \(y\/n\):')
child.sendline('y')
child.expect(pexpect.EOF)
def get(self, path):
return pexpect.run('curl http://%s-%s.rhcloud.com%s' % (
self.app, domain, path))
def test_index(self):
assert self.title in self.html, self.html
class TestPyramid(OpenShiftQuickstartTest, unittest.TestCase):
app = 'pyramid'
title = '<a href="1">test name</a>'
class TestTurboGears2(OpenShiftQuickstartTest, unittest.TestCase):
app = 'turbogears2'
title = 'Welcome to TurboGears'
class TestDrupal(OpenShiftQuickstartTest, unittest.TestCase):
app = 'drupal'
title = 'Welcome to OpenShift Drupal'
class TestRails(OpenShiftQuickstartTest, unittest.TestCase):
app = 'rails'
title = 'Home#index'
class TestDjango(OpenShiftQuickstartTest, unittest.TestCase):
app = 'django'
title = 'Yeah Django!'
class TestWordpress(OpenShiftQuickstartTest, unittest.TestCase):
app = 'wordpress'
title = 'WordPress'
index = '/wp-admin/install.php'
class TestMediaWiki(OpenShiftQuickstartTest, unittest.TestCase):
app = 'mediawiki'
title = 'MediaWiki has been successfully installed'
index = '/index.php/Main_Page'
class TestPyBlosxom(OpenShiftQuickstartTest, unittest.TestCase):
app = 'pyblosxom'
title = 'A PyBlosxom blog running in the Red Hat Cloud!'
db = False
class TestCakePHP(OpenShiftQuickstartTest, unittest.TestCase):
app = 'cakephp'
title = 'CakePHP: the rapid development php framework'
class TestSeamBooking(OpenShiftQuickstartTest, unittest.TestCase):
app = 'seambooking'
title = 'Created with Seam'
db = False
class TestFrogCMS(OpenShiftQuickstartTest, unittest.TestCase):
app = 'frogcms'
title = 'Powered by <a href="http://www.madebyfrog.com/" alt="Frog">'
class TestWolfCMS(OpenShiftQuickstartTest, unittest.TestCase):
app = 'wolfcms'
title = '<a href="http://www.wolfcms.org/" title="Wolf CMS">Wolf CMS</a>'
class TestReviewBoard(OpenShiftQuickstartTest, unittest.TestCase):
app = 'reviewboard'
title = 'Log In | Review Board'
index = '/account/login/?next_page=/dashboard/'
class TestSQLBuddy(OpenShiftQuickstartTest, unittest.TestCase):
app = 'sqlbuddy'
title = 'SQL Buddy'
index = '/sqlbuddy/login.php'
class TestFlask(OpenShiftQuickstartTest, unittest.TestCase):
app = 'flask'
title = 'Hello World!'
db = False
class TestDancer(OpenShiftQuickstartTest, unittest.TestCase):
app = 'dancer'
title = 'Perl is dancing'
db = False
class TestSinatra(OpenShiftQuickstartTest, unittest.TestCase):
app = 'sinatra'
title = 'the time where this server lives is'
db = False
class TestPiwik(OpenShiftQuickstartTest, unittest.TestCase):
app = 'piwik'
title = 'Open Source Web Analytics'
class TestSugarCRM(OpenShiftQuickstartTest, unittest.TestCase):
app = 'sugarcrm'
title = 'Sugar Setup Wizard'
index = '/install.php?goto=SilentInstall&cli=true'
class TestJoomla(OpenShiftQuickstartTest, unittest.TestCase):
app = 'joomla'
title = 'Congratulations! You have a Joomla! site!'
class TestPHPBB(OpenShiftQuickstartTest, unittest.TestCase):
app = 'phpbb'
title = 'This page was generated by phpBB'
if __name__ == '__main__':
if not login:
login = raw_input('Login: ').strip()
if not domain:
domain = raw_input('Domain: ').strip()
if not password:
password = getpass.getpass('Password: ')
unittest.main(verbosity=2)