def test_sprint(self): # Sprints are a special case. They are not ISpecificationTargets, # nor can they be adapted to a ISpecificationTarget, # but can create a spcification for a ISpecificationTarget. context = self.factory.makeSprint(title='Walnut', name='walnut') self.assertFalse(ISpecificationTarget.providedBy(context)) self.verify_view(context, 'sprints/%s' % context.name)
def target_url(self): """The +addspec URL for the specifiation target or None""" # Check if the context has an +addspec view available. if queryMultiAdapter((self.context, self.request), name='+addspec'): target = self.context else: # otherwise find an adapter to ISpecificationTarget which will. target = ISpecificationTarget(self.context) if target is None: return None else: return canonical_url(target, rootsite='blueprints', view_name='+addspec')
def test_adaptable_to_specificationtarget(self): context = self.factory.makeProject(name='hazelnut') self.assertFalse(ISpecificationTarget.providedBy(context)) self.verify_view(context, context.name)
def test_specificationtarget(self): context = self.factory.makeProduct(name='almond') self.assertTrue(ISpecificationTarget.providedBy(context)) self.verify_view(context, context.name)