26
26
self.mails.append((sender, rcpt, msg))
29
class FakeLaunchpadMilestone(object):
30
def __init__(self, name):
33
self.date_targeted = None
40
class FakeLaunchpadProject(object):
41
def __init__(self, title, milestone):
43
self.all_milestones = [milestone]
29
49
class FakeBuilder(object):
30
50
def __init__(self, current_state, build_result=None):
31
51
self.name = u"test-builder"
198
218
"id SERIAL NOT NULL PRIMARY KEY, "
199
219
"dailybuildorder_id integer NOT NULL, "
200
220
"project_id VARCHAR(200) NOT NULL)")
222
self.connection.execute(
223
"CREATE TABLE launchpad_projects ( "
224
"name varchar(200) NOT NULL PRIMARY KEY, "
225
"title varchar(200)) ")
227
self.connection.execute(
228
"CREATE TABLE launchpad_project_milestones ("
229
"id serial NOT NULL PRIMARY KEY, "
230
"name varchar(200) NOT NULL, "
231
"launchpad_project_id varchar(200) REFERENCES "
232
"launchpad_projects (name) DEFERRABLE INITIALLY DEFERRED, "
233
"title varchar(200) NOT NULL, "
234
"date_targeted date, "
235
"active boolean NOT NULL)")
237
self.connection.execute(
238
"CREATE TABLE releases ( "
239
"build_id integer NOT NULL PRIMARY KEY REFERENCES buildresults (id) DEFERRABLE INITIALLY DEFERRED, "
240
"name varchar(200) NOT NULL, "
241
"milestone_id integer REFERENCES launchpad_project_milestones (id) DEFERRABLE INITIALLY DEFERRED, "
243
"creator_id integer NOT NULL REFERENCES auth_user (id) DEFERRABLE INITIALLY DEFERRED, "
244
"created_at timestamp with time zone NOT NULL, "
245
"updated_at timestamp with time zone NOT NULL, "
246
"published_at timestamp with time zone, "
247
"checklist_url varchar(200) NOT NULL, "
248
"notes text NOT NULL, "
249
"status smallint CHECK (status >= 0) NOT NULL)")
201
251
self.connection.commit()
203
253
def create_db_store(self):
208
258
self.db_store.close()
210
260
def drop_tables(self):
211
for table in ["auth_user", "projects", "lexbuilders",
212
"project_notification_subscriptions",
261
for table in ["auth_user", "releases", "launchpad_projects", "projects",
262
"lexbuilders", "project_notification_subscriptions",
213
263
"buildresults", "buildrequests", "dailybuildorders",
214
"dailybuildorders_projects"]:
264
"dailybuildorders_projects",
265
"launchpad_project_milestones"]:
216
self.connection.execute("DROP TABLE %s" % table)
267
self.connection.execute("DROP TABLE %s CASCADE" % table)
217
268
self.connection.commit()
219
270
self.connection.rollback()