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_process_factory.py
76 lines (70 loc) · 2.85 KB
/
test_process_factory.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import unittest
from buildbotcustom.process.factory import ReleaseUpdatesFactory
class SimpleUpdatesFactory(ReleaseUpdatesFactory):
def __init__(self, version, releaseChannel, useBetaChannelForRelease):
self.version = version
self.releaseChannel = releaseChannel
self.useBetaChannelForRelease = useBetaChannelForRelease
self.setChannelData()
def getSnippetDir(self):
return 'foo'
class TestReleaseUpdatesFactory(unittest.TestCase):
def testSetChannelDataWithBetaAndReleaseChannel(self):
expectedChannels = {
'betatest': {'dir': 'aus2.test'},
'releasetest': {'dir': 'aus2.test'},
'beta': {'dir': 'aus2.beta'},
'release': {'dir': 'aus2', 'compareTo': 'releasetest'},
}
expectedDirMap = {
'aus2.test': 'foo-test',
'aus2.beta': 'foo-beta',
'aus2': 'foo',
}
uf = SimpleUpdatesFactory('3.6.26', 'release', True)
self.assertEqual(uf.channels, expectedChannels)
self.assertEqual(uf.dirMap, expectedDirMap)
self.assertEqual(uf.testChannel, 'betatest')
def testSetChannelDataWithBetaChannelOnly(self):
expectedChannels = {
'betatest': {'dir': 'aus2.test'},
'releasetest': {'dir': 'aus2.test'},
'beta': {'dir': 'aus2', 'compareTo': 'releasetest'},
}
expectedDirMap = {
'aus2.test': 'foo-test',
'aus2': 'foo',
}
uf = SimpleUpdatesFactory('10.0b6', 'beta', False)
self.assertEqual(uf.channels, expectedChannels)
self.assertEqual(uf.dirMap, expectedDirMap)
self.assertEqual(uf.testChannel, 'betatest')
def testSetChannelDataWithReleaseChannelOnly(self):
expectedChannels = {
'betatest': {'dir': 'aus2.test'},
'releasetest': {'dir': 'aus2.test'},
'release': {'dir': 'aus2', 'compareTo': 'releasetest'},
}
expectedDirMap = {
'aus2.test': 'foo-test',
'aus2': 'foo',
}
uf = SimpleUpdatesFactory('9.0.1', 'release', False)
self.assertEqual(uf.channels, expectedChannels)
self.assertEqual(uf.dirMap, expectedDirMap)
self.assertEqual(uf.testChannel, 'betatest')
def testSetChannelDataWithEsrChannelOnly(self):
expectedChannels = {
'betatest': {'dir': 'aus2.test'},
'releasetest': {'dir': 'aus2.test'},
'esrtest': {'dir': 'aus2.test'},
'esr': {'dir': 'aus2', 'compareTo': 'releasetest'},
}
expectedDirMap = {
'aus2.test': 'foo-test',
'aus2': 'foo',
}
uf = SimpleUpdatesFactory('10.0esr', 'esr', False)
self.assertEqual(uf.channels, expectedChannels)
self.assertEqual(uf.dirMap, expectedDirMap)
self.assertEqual(uf.testChannel, 'esrtest')