1
# Copyright 2010 Canonical Ltd. This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
7
"HasTestRankProjectsMixin",
10
from unittest import defaultTestLoader
12
from lp.results.testing.layers import FunctionalDatabaseLayer
15
class HasTestRankProjectsMixin:
17
layer = FunctionalDatabaseLayer
19
def test_getRecommendedTestProjectsNone(self):
20
self.factory.makeTestPerson(name=u"container1")
21
self.factory.makeTestProject(name=u"container1")
23
container1 = self.getContainerByName(u"container1")
24
projects = container1.getRecommendedTestProjects()
25
self.assertEquals(projects.count(), 0)
27
def test_getRecommendedTestProjectsOne(self):
28
person1 = self.factory.makeTestPerson(name=u"container1")
29
person2 = self.factory.makeTestPerson(name=u"container2")
30
project1 = self.factory.makeTestProject(name=u"container1")
31
project2 = self.factory.makeTestProject(name=u"container2")
33
project1.incrementTestStat(person1)
34
project1.incrementTestStat(person2)
35
project2.incrementTestStat(person2)
37
container1 = self.getContainerByName(u"container1")
38
projects = container1.getRecommendedTestProjects()
39
self.assertEquals(projects.count(), 1)
40
self.assertEquals(projects[0], project2)
44
return defaultTestLoader.loadTestsFromName(__name__)