Commit 3855cf92 authored by Michal Čihař's avatar Michal Čihař

Add notification hooks tests

parent b1cd57ef
......@@ -30,3 +30,4 @@ from weblate.trans.tests.test_models import *
from weblate.trans.tests.test_views import *
from weblate.trans.tests.test_commands import *
from weblate.trans.tests.test_exports import *
from weblate.trans.tests.test_hooks import *
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2013 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
"""
Tests for notification hooks.
"""
from django.core.urlresolvers import reverse
from django.utils import simplejson
from weblate.trans.tests.test_views import ViewTestCase
class HooksViewTest(ViewTestCase):
def test_view_hook_project(self):
response = self.client.get(
reverse('hook-project', kwargs={
'project': self.subproject.project.slug
})
)
self.assertContains(response, 'update triggered')
def test_view_hook_subproject(self):
response = self.client.get(
reverse('hook-subproject', kwargs={
'project': self.subproject.project.slug,
'subproject': self.subproject.slug,
})
)
self.assertContains(response, 'update triggered')
......@@ -180,10 +180,10 @@ urlpatterns = patterns('',
url(r'^checks/(?P<name>[^/]*)/(?P<project>[^/]*)/$', 'weblate.trans.views.show_check_project'),
url(r'^checks/(?P<name>[^/]*)/(?P<project>[^/]*)/(?P<subproject>[^/]*)/$', 'weblate.trans.views.show_check_subproject'),
url(r'^hooks/update/(?P<project>[^/]*)/(?P<subproject>[^/]*)/$', 'weblate.trans.api.update_subproject'),
url(r'^hooks/update/(?P<project>[^/]*)/$', 'weblate.trans.api.update_project'),
url(r'^hooks/github/$', 'weblate.trans.api.git_service_hook', {'service': 'github'}),
url(r'^hooks/bitbucket/$', 'weblate.trans.api.git_service_hook', {'service': 'bitbucket'}),
url(r'^hooks/update/(?P<project>[^/]*)/(?P<subproject>[^/]*)/$', 'weblate.trans.api.update_subproject', name='hook-subproject'),
url(r'^hooks/update/(?P<project>[^/]*)/$', 'weblate.trans.api.update_project', name='hook-project'),
url(r'^hooks/github/$', 'weblate.trans.api.git_service_hook', {'service': 'github'}, name='hook-github'),
url(r'^hooks/bitbucket/$', 'weblate.trans.api.git_service_hook', {'service': 'bitbucket'}, name='hook-bitbucket'),
url(r'^exports/stats/(?P<project>[^/]*)/(?P<subproject>[^/]*)/$', 'weblate.trans.api.export_stats', name='export-stats'),
......
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