Beispiel #1
0
 def test_count(self):
     # The 'count' property of a collection is the number of elements in
     # the collection.
     collection = GenericBranchMergeQueueCollection(self.store)
     self.assertEqual(0, collection.count())
     for i in range(3):
         self.factory.makeBranchMergeQueue()
     self.assertEqual(3, collection.count())
 def test_count(self):
     # The 'count' property of a collection is the number of elements in
     # the collection.
     collection = GenericBranchMergeQueueCollection(self.store)
     self.assertEqual(0, collection.count())
     for i in range(3):
         self.factory.makeBranchMergeQueue()
     self.assertEqual(3, collection.count())
Beispiel #3
0
 def test_count_respects_filter(self):
     # If a collection is a subset of all possible queues, then the count
     # will be the size of that subset. That is, 'count' respects any
     # filters that are applied.
     person = self.factory.makePerson()
     self.factory.makeBranchMergeQueue(owner=person)
     self.factory.makeAnyBranch()
     collection = GenericBranchMergeQueueCollection(
         self.store, [BranchMergeQueue.owner == person])
     self.assertEqual(1, collection.count())
 def test_count_respects_filter(self):
     # If a collection is a subset of all possible queues, then the count
     # will be the size of that subset. That is, 'count' respects any
     # filters that are applied.
     person = self.factory.makePerson()
     self.factory.makeBranchMergeQueue(owner=person)
     self.factory.makeAnyBranch()
     collection = GenericBranchMergeQueueCollection(
         self.store, [BranchMergeQueue.owner == person])
     self.assertEqual(1, collection.count())