def test_isOneOfDrivers(self):
     # The person can be one of multiple drivers of if an object
     # implements IHasDrivers.
     productseries = self.factory.makeProductSeries()
     productseries.product.driver = self.person
     productseries.driver = self.factory.makePerson()
     roles = IPersonRoles(self.person)
     self.assertTrue(roles.isOneOfDrivers(productseries))
 def test_isOneOfDrivers_no_drivers(self):
     # If the object does not implement IHasDrivers, False is returned.
     sprint = self.factory.makeSprint()
     roles = IPersonRoles(self.person)
     self.assertFalse(roles.isOneOfDrivers(sprint))
예제 #3
0
 def personHasDriverRights(self, person):
     """See `IHasDrivers`."""
     person_roles = IPersonRoles(person)
     return (person_roles.isOneOfDrivers(self) or
             person_roles.isOwner(self) or
             person_roles.in_admin)