def test_delete_by_subscribers(self): """`BugSubscriptionFilter`s can only be deleted by subscribers.""" bug_subscription_filter = BugSubscriptionFilter() bug_subscription_filter.structural_subscription = self.subscription bug_subscription_filter = ProxyFactory(bug_subscription_filter) # Anonymous users are denied rights to delete the filter. with anonymous_logged_in(): self.assertRaises( Unauthorized, getattr, bug_subscription_filter, "delete") # Any other person is also denied. with person_logged_in(self.factory.makePerson()): self.assertRaises( Unauthorized, getattr, bug_subscription_filter, "delete") # The subscriber can delete the filter. with person_logged_in(self.subscriber): bug_subscription_filter.delete()
def test_delete_by_subscribers(self): """`BugSubscriptionFilter`s can only be deleted by subscribers.""" bug_subscription_filter = BugSubscriptionFilter() bug_subscription_filter.structural_subscription = self.subscription bug_subscription_filter = ProxyFactory(bug_subscription_filter) # Anonymous users are denied rights to delete the filter. with anonymous_logged_in(): self.assertRaises(Unauthorized, getattr, bug_subscription_filter, "delete") # Any other person is also denied. with person_logged_in(self.factory.makePerson()): self.assertRaises(Unauthorized, getattr, bug_subscription_filter, "delete") # The subscriber can delete the filter. with person_logged_in(self.subscriber): bug_subscription_filter.delete()
def test_delete(self): """`BugSubscriptionFilter` objects can be deleted. Child objects - like `BugSubscriptionFilterTags` - will also be deleted. """ # This is a second filter for the subscription. bug_subscription_filter = BugSubscriptionFilter() bug_subscription_filter.structural_subscription = self.subscription bug_subscription_filter.importances = [BugTaskImportance.LOW] bug_subscription_filter.statuses = [BugTaskStatus.NEW] bug_subscription_filter.tags = [u"foo"] IStore(bug_subscription_filter).flush() self.assertIsNot(None, Store.of(bug_subscription_filter)) # Delete. bug_subscription_filter.delete() IStore(bug_subscription_filter).flush() # It doesn't exist in the database anymore. self.assertIs(None, Store.of(bug_subscription_filter))
def test_delete(self): """`BugSubscriptionFilter` objects can be deleted. Child objects - like `BugSubscriptionFilterTags` - will also be deleted. """ # This is a second filter for the subscription. bug_subscription_filter = BugSubscriptionFilter() bug_subscription_filter.structural_subscription = self.subscription bug_subscription_filter.importances = [BugTaskImportance.LOW] bug_subscription_filter.statuses = [BugTaskStatus.NEW] bug_subscription_filter.tags = [u"foo"] IStore(bug_subscription_filter).flush() self.assertIsNot(None, Store.of(bug_subscription_filter)) # Delete. bug_subscription_filter.delete() IStore(bug_subscription_filter).flush() # It doesn't exist in the database anymore. self.assertIs(None, Store.of(bug_subscription_filter))