Skip to content

Commit

Permalink
Add unit test for github change hook codebase parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
esben authored and Mikhail Sobolev committed May 21, 2015
1 parent 606944a commit 8b9828c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions master/buildbot/test/unit/test_www_hooks_github.py
Expand Up @@ -27,6 +27,7 @@
from buildbot.test.fake.web import fakeMasterForHooks

from twisted.trial import unittest
from twisted.internet import defer

# Sample GITHUB commit payload from http://help.github.com/post-receive-hooks/
# Added "modfied" and "removed", and change email
Expand Down Expand Up @@ -493,3 +494,23 @@ def check_result(result):
self.assertEqual(self.request.written, expected)

return d


class TestChangeHookConfiguredWithCodebaseValue(unittest.TestCase):

def setUp(self):
self.changeHook = _prepare_github_change_hook(codebase='foobar')

@defer.inlineCallbacks
def _check_git_with_change(self, payload):
self.request = _prepare_request('push', payload)
yield self.request.test_render(self.changeHook)
self.assertEquals(len(self.request.addedChanges), 2)
change = self.request.addedChanges[0]
self.assertEquals(change['codebase'], 'foobar')

def test_git_with_change_encoded(self):
return self._check_git_with_change([gitJsonPayload])

def test_git_with_change_json(self):
return self._check_git_with_change(gitJsonPayload)

0 comments on commit 8b9828c

Please sign in to comment.