188
188
def test_get_specification_on_product(self):
189
189
product = self.factory.makeProduct(name="fooix")
190
spec_object = self.factory.makeSpecification(
190
self.factory.makeSpecification(
191
191
product=product, name="some-spec")
192
192
product_on_webservice = self.getPillarOnWebservice(product)
193
193
spec = product_on_webservice.getSpecification(name="some-spec")
197
197
def test_get_specification_on_distribution(self):
198
198
distribution = self.factory.makeDistribution(name="foobuntu")
199
spec_object = self.factory.makeSpecification(
199
self.factory.makeSpecification(
200
200
distribution=distribution, name="some-spec")
201
201
distro_on_webservice = self.getPillarOnWebservice(distribution)
202
202
spec = distro_on_webservice.getSpecification(name="some-spec")
207
207
product = self.factory.makeProduct(name="fooix")
208
208
productseries = self.factory.makeProductSeries(
209
209
product=product, name="fooix-dev")
210
spec_object = self.factory.makeSpecification(
210
self.factory.makeSpecification(
211
211
product=product, name="some-spec", goal=productseries)
212
212
product_on_webservice = self.getPillarOnWebservice(product)
213
213
productseries_on_webservice = product_on_webservice.getSeries(
220
220
distribution = self.factory.makeDistribution(name="foobuntu")
221
221
distroseries = self.factory.makeDistroSeries(
222
222
distribution=distribution, name="maudlin")
223
spec_object = self.factory.makeSpecification(
223
self.factory.makeSpecification(
224
224
distribution=distribution, name="some-spec",
225
225
goal=distroseries)
226
226
distro_on_webservice = self.getPillarOnWebservice(distribution)
333
333
result = webservice.named_get(
334
334
subscription['self_link'], 'canBeUnsubscribedByUser').jsonBody()
335
335
self.assertFalse(result)
338
class TestSpecificationBugLinks(SpecificationWebserviceTestCase):
340
layer = AppServerLayer
342
def test_bug_linking(self):
343
# Set up a spec, person, and bug.
344
with person_logged_in(ANONYMOUS):
345
db_spec = self.factory.makeSpecification()
346
db_person = self.factory.makePerson()
347
db_bug = self.factory.makeBug()
348
launchpad = self.factory.makeLaunchpadService()
350
# Link the bug to the spec via the web service.
351
with person_logged_in(db_person):
352
spec = ws_object(launchpad, db_spec)
353
bug = ws_object(launchpad, db_bug)
354
# There are no bugs associated with the spec/blueprint yet.
355
self.assertEqual(0, spec.bugs.total_size)
356
spec.linkBug(bug=bug)
359
# The spec now has one bug associated with it and that bug is the one
361
self.assertEqual(1, spec.bugs.total_size)
362
self.assertEqual(bug.id, spec.bugs[0].id)
364
def test_bug_unlinking(self):
365
# Set up a spec, person, and bug, then link the bug to the spec.
366
with person_logged_in(ANONYMOUS):
367
db_spec = self.factory.makeBlueprint()
368
db_person = self.factory.makePerson()
369
db_bug = self.factory.makeBug()
370
launchpad = self.factory.makeLaunchpadService(person=db_person)
372
spec = ws_object(launchpad, db_spec)
373
bug = ws_object(launchpad, db_bug)
374
spec.linkBug(bug=bug)
376
# There is only one bug linked at the moment.
377
self.assertEqual(1, spec.bugs.total_size)
379
spec.unlinkBug(bug=bug)
382
# Now that we've unlinked the bug, there are no linked bugs at all.
383
self.assertEqual(0, spec.bugs.total_size)