Esempio n. 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())
Esempio n. 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())
Esempio n. 5
0
 def test_getMergeQueues_no_filter(self):
     # If no filter is specified, then the collection is of all branch
     # merge queues.
     collection = GenericBranchMergeQueueCollection(self.store)
     queue = self.factory.makeBranchMergeQueue()
     self.assertEqual([queue], list(collection.getMergeQueues()))
Esempio n. 6
0
 def test_getMergeQueues_no_filter_no_queues(self):
     # If no filter is specified, then the collection is of all branches
     # merge queues. By default, there are no branch merge queues.
     collection = GenericBranchMergeQueueCollection(self.store)
     self.assertEqual([], list(collection.getMergeQueues()))
Esempio n. 7
0
 def test_provides_branchmergequeuecollection(self):
     # `GenericBranchMergeQueueCollection`
     # provides the `IBranchMergeQueueCollection` interface.
     self.assertProvides(GenericBranchMergeQueueCollection(self.store),
                         IBranchMergeQueueCollection)
 def test_getMergeQueues_no_filter(self):
     # If no filter is specified, then the collection is of all branch
     # merge queues.
     collection = GenericBranchMergeQueueCollection(self.store)
     queue = self.factory.makeBranchMergeQueue()
     self.assertEqual([queue], list(collection.getMergeQueues()))
 def test_getMergeQueues_no_filter_no_queues(self):
     # If no filter is specified, then the collection is of all branches
     # merge queues. By default, there are no branch merge queues.
     collection = GenericBranchMergeQueueCollection(self.store)
     self.assertEqual([], list(collection.getMergeQueues()))