6
8
from unittest import defaultTestLoader
8
10
from zope.component import getUtility
10
from lp.results.interfaces import IProjectSet
12
from lp.results.interfaces import (
12
17
from lp.results.testing.cases import TestCaseWithFactory
13
18
from lp.results.testing.layers import FunctionalDatabaseLayer
23
28
self.assertNotEquals(project, None)
24
29
self.assertEquals(project.name, u"hello")
26
def test_dateLastTested(self):
27
person = self.factory.makePerson()
28
project = getUtility(IProjectSet).create(person, u"hello")
29
self.assertEquals(project.date_last_tested, None)
30
project.createTestRun(person)
31
self.assertNotEquals(project.date_last_tested, None)
32
project = self.factory.makeProject()
33
other = getUtility(IProjectSet).get(project.id)
34
self.assertNotEquals(other, None)
35
self.assertEquals(other, project)
37
def test_getByName(self):
38
name = self.factory.getUniqueString(u"project-name")
39
other = getUtility(IProjectSet).getByName(name)
40
self.assertEquals(other, None)
42
project = self.factory.makeProject(name=name)
43
other = getUtility(IProjectSet).getByName(name)
44
self.assertNotEquals(other, None)
45
self.assertEquals(other, project)
47
def test_searchName(self):
48
name = self.factory.getUniqueString(u"project-name")
49
params = ProjectSearchParams(name=name)
50
other = getUtility(IProjectSet).search(params).one()
51
self.assertEquals(other, None)
53
project = self.factory.makeProject(name=name)
54
other = getUtility(IProjectSet).search(params).one()
55
self.assertNotEquals(other, None)
56
self.assertEquals(other, project)