Commit a872ef00 authored by Michal Čihař's avatar Michal Čihař

Add test for github hook

parent 57d57fd2
......@@ -27,6 +27,49 @@ from django.utils import simplejson
from weblate.trans.tests.test_views import ViewTestCase
from weblate.trans import appsettings
GITHUB_PAYLOAD = '''
{
"before": "5aef35982fb2d34e9d9d4502f6ede1072793222d",
"repository": {
"url": "http://github.com/defunkt/github",
"name": "github",
"description": "You're lookin' at it.",
"watchers": 5,
"forks": 2,
"private": 1,
"owner": {
"email": "chris@ozmm.org",
"name": "defunkt"
}
},
"commits": [
{
"id": "41a212ee83ca127e3c8cf465891ab7216a705f59",
"url": "http://github.com/defunkt/github/commit/41a212ee83ca127e3c8cf465891ab7216a705f59",
"author": {
"email": "chris@ozmm.org",
"name": "Chris Wanstrath"
},
"message": "okay i give in",
"timestamp": "2008-02-15T14:57:17-08:00",
"added": ["filepath.rb"]
},
{
"id": "de8251ff97ee194a289832576287d6f8ad74e3d0",
"url": "http://github.com/defunkt/github/commit/de8251ff97ee194a289832576287d6f8ad74e3d0",
"author": {
"email": "chris@ozmm.org",
"name": "Chris Wanstrath"
},
"message": "update pricing a tad",
"timestamp": "2008-02-15T14:36:34-08:00"
}
],
"after": "de8251ff97ee194a289832576287d6f8ad74e3d0",
"ref": "refs/heads/master"
}
'''
class HooksViewTest(ViewTestCase):
def test_view_hook_project(self):
......@@ -47,3 +90,11 @@ class HooksViewTest(ViewTestCase):
})
)
self.assertContains(response, 'update triggered')
def test_view_hook_github(self):
appsettings.BACKGROUND_HOOKS = False
response = self.client.post(
reverse('hook-github'),
{'payload': GITHUB_PAYLOAD}
)
self.assertContains(response, 'update triggered')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment