This repository has been archived by the owner on Jun 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
test_misc_important.py
47 lines (37 loc) · 1.76 KB
/
test_misc_important.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from twisted.trial import unittest
from buildbotcustom.misc import makeImportantFunc
class Change(object):
files = []
revlink = None
comments = ""
revision = None
def __init__(self, files=None, revlink=None, comments=None, revision=None):
if files:
self.files = files
if revlink:
self.revlink = revlink
if comments:
self.comments = comments
if revision:
self.revision = revision
class TestProductImportance(unittest.TestCase):
def testImportant(self):
f = makeImportantFunc('http://hg.mozilla.org/mozilla-central', 'firefox')
c = Change(revlink="http://hg.mozilla.org/mozilla-central/rev/1234", files=['browser/foo', 'mobile/bar'])
self.assertTrue(f(c))
def testUnImportant(self):
f = makeImportantFunc('http://hg.mozilla.org/mozilla-central', 'firefox')
c = Change(revlink="http://hg.mozilla.org/mozilla-central/rev/1234", files=['b2g/foo', 'mobile/bar'])
self.assertFalse(f(c))
def testDontBuild(self):
f = makeImportantFunc('http://hg.mozilla.org/mozilla-central', 'firefox')
c = Change(revlink="http://hg.mozilla.org/mozilla-central/rev/1234", files=['browser/foo', 'mobile/bar'], comments="DONTBUILD me")
self.assertFalse(f(c))
def testNonpollerChange(self):
f = makeImportantFunc('http://hg.mozilla.org/mozilla-central', 'firefox')
c = Change(revlink="", files=['browser/foo', 'mobile/bar'])
self.assertFalse(f(c))
def testImportantNoProduct(self):
f = makeImportantFunc('http://hg.mozilla.org/mozilla-central', None)
c = Change(revlink="http://hg.mozilla.org/mozilla-central/rev/1234", files=['browser/foo', 'mobile/bar'])
self.assertTrue(f(c))