~mwhudson/bzr-builder/RecipeParserTests-inherit-TestCase

« back to all changes in this revision

Viewing changes to tests/test_recipe.py

  • Committer: James Westby
  • Date: 2009-12-01 20:12:26 UTC
  • mfrom: (52.2.1 working)
  • Revision ID: james.westby@canonical.com-20091201201226-gi1gpv06plrjld0a
Refactor to use objects and polymorphism rather than tuples and if blocks.

Thanks Andrew.

Show diffs side-by-side

added added

removed removed

Lines of Context:
216
216
                + "merge bar http://bar.org")
217
217
        self.check_base_recipe_branch(base_branch, "http://foo.org/",
218
218
                num_child_branches=1)
219
 
        child_branch, location = base_branch.child_branches[0]
 
219
        child_branch, location = base_branch.child_branches[0].as_tuple()
220
220
        self.assertEqual(None, location)
221
221
        self.check_recipe_branch(child_branch, "bar", "http://bar.org")
222
222
 
225
225
                + "nest bar http://bar.org baz")
226
226
        self.check_base_recipe_branch(base_branch, "http://foo.org/",
227
227
                num_child_branches=1)
228
 
        child_branch, location = base_branch.child_branches[0]
 
228
        child_branch, location = base_branch.child_branches[0].as_tuple()
229
229
        self.assertEqual("baz", location)
230
230
        self.check_recipe_branch(child_branch, "bar", "http://bar.org")
231
231
 
234
234
                + "nest bar http://bar.org baz\nmerge zam lp:zam")
235
235
        self.check_base_recipe_branch(base_branch, "http://foo.org/",
236
236
                num_child_branches=2)
237
 
        child_branch, location = base_branch.child_branches[0]
 
237
        child_branch, location = base_branch.child_branches[0].as_tuple()
238
238
        self.assertEqual("baz", location)
239
239
        self.check_recipe_branch(child_branch, "bar", "http://bar.org")
240
 
        child_branch, location = base_branch.child_branches[1]
 
240
        child_branch, location = base_branch.child_branches[1].as_tuple()
241
241
        self.assertEqual(None, location)
242
242
        self.check_recipe_branch(child_branch, "zam", "lp:zam")
243
243
 
246
246
                + "merge zam lp:zam\nnest bar http://bar.org baz")
247
247
        self.check_base_recipe_branch(base_branch, "http://foo.org/",
248
248
                num_child_branches=2)
249
 
        child_branch, location = base_branch.child_branches[0]
 
249
        child_branch, location = base_branch.child_branches[0].as_tuple()
250
250
        self.assertEqual(None, location)
251
251
        self.check_recipe_branch(child_branch, "zam", "lp:zam")
252
 
        child_branch, location = base_branch.child_branches[1]
 
252
        child_branch, location = base_branch.child_branches[1].as_tuple()
253
253
        self.assertEqual("baz", location)
254
254
        self.check_recipe_branch(child_branch, "bar", "http://bar.org")
255
255
 
258
258
                + "nest bar http://bar.org baz\n  merge zam lp:zam")
259
259
        self.check_base_recipe_branch(base_branch, "http://foo.org/",
260
260
                num_child_branches=1)
261
 
        child_branch, location = base_branch.child_branches[0]
 
261
        child_branch, location = base_branch.child_branches[0].as_tuple()
262
262
        self.assertEqual("baz", location)
263
263
        self.check_recipe_branch(child_branch, "bar", "http://bar.org",
264
264
                num_child_branches=1)
265
 
        child_branch, location = child_branch.child_branches[0]
 
265
        child_branch, location = child_branch.child_branches[0].as_tuple()
266
266
        self.assertEqual(None, location)
267
267
        self.check_recipe_branch(child_branch, "zam", "lp:zam")
268
268
 
271
271
                + "nest bar http://bar.org baz\n  nest zam lp:zam zoo")
272
272
        self.check_base_recipe_branch(base_branch, "http://foo.org/",
273
273
                num_child_branches=1)
274
 
        child_branch, location = base_branch.child_branches[0]
 
274
        child_branch, location = base_branch.child_branches[0].as_tuple()
275
275
        self.assertEqual("baz", location)
276
276
        self.check_recipe_branch(child_branch, "bar", "http://bar.org",
277
277
                num_child_branches=1)
278
 
        child_branch, location = child_branch.child_branches[0]
 
278
        child_branch, location = child_branch.child_branches[0].as_tuple()
279
279
        self.assertEqual("zoo", location)
280
280
        self.check_recipe_branch(child_branch, "zam", "lp:zam")
281
281
 
286
286
                + "merge zam lp:zam 2")
287
287
        self.check_base_recipe_branch(base_branch, "http://foo.org/",
288
288
                num_child_branches=2, revspec="revid:a")
289
 
        child_branch, location = base_branch.child_branches[0]
 
289
        instruction = base_branch.child_branches[0]
 
290
        child_branch = instruction.recipe_branch
 
291
        location = instruction.nest_path
290
292
        self.assertEqual("baz", location)
291
293
        self.check_recipe_branch(child_branch, "bar", "http://bar.org",
292
294
                revspec="tag:b")
293
 
        child_branch, location = base_branch.child_branches[1]
 
295
        child_branch, location = base_branch.child_branches[1].as_tuple()
294
296
        self.assertEqual(None, location)
295
297
        self.check_recipe_branch(child_branch, "zam", "lp:zam", revspec="2")
296
298
 
300
302
                + "run touch test \n")
301
303
        self.check_base_recipe_branch(base_branch, "http://foo.org/",
302
304
                num_child_branches=1)
303
 
        child_branch, command = base_branch.child_branches[0]
 
305
        child_branch, command = base_branch.child_branches[0].as_tuple()
304
306
        self.assertEqual(None, child_branch)
305
307
        self.assertEqual("touch test", command)
306
308