forked from buildbot/buildbot
-
Notifications
You must be signed in to change notification settings - Fork 6
/
test_source_repourl.py
37 lines (28 loc) · 1002 Bytes
/
test_source_repourl.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
from twisted.trial import unittest
from buildbot.steps.source import Source
class SourceStamp(object):
repository = "test"
class Build(object):
s = SourceStamp()
def getSourceStamp(self):
return self.s
class RepoURL(unittest.TestCase):
def test_backward_compatibility(self):
s = Source()
s.build = Build()
self.assertEqual(s.computeRepositoryURL("repourl"), "repourl")
def test_format_string(self):
s = Source()
s.build = Build()
self.assertEquals(s.computeRepositoryURL("http://server/%s"), "http://server/test")
def test_dict(self):
s = Source()
s.build = Build()
dict = {}
dict['test'] = "ssh://server/testrepository"
self.assertEquals(s.computeRepositoryURL(dict), "ssh://server/testrepository")
def test_callable(self):
s = Source()
s.build = Build()
func = lambda x: x[::-1]
self.assertEquals(s.computeRepositoryURL(func), "tset")