@@ -0,0 +1,2090 @@
+# -*- coding: utf8 -*-%0A# This file is part of PyBossa.%0A#%0A# Copyright (C) 2015 SciFabric LTD.%0A#%0A# PyBossa is free software: you can redistribute it and/or modify%0A# it under the terms of the GNU Affero General Public License as published by%0A# the Free Software Foundation, either version 3 of the License, or%0A# (at your option) any later version.%0A#%0A# PyBossa is distributed in the hope that it will be useful,%0A# but WITHOUT ANY WARRANTY; without even the implied warranty of%0A# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A# GNU Affero General Public License for more details.%0A#%0A# You should have received a copy of the GNU Affero General Public License%0A# along with PyBossa.  If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A%0A%0Afrom helper import web%0Afrom default import with_context%0Afrom factories import ProjectFactory%0Afrom pybossa.core import user_repo%0A%0Aclass TestWebhookView(web.Helper):%0A%0A    @with_context%0A    def test_webhook_handler_anon(self):%0A        %22%22%22Test WEBHOOK view works for anons.%22%22%22%0A        project = ProjectFactory.create()%0A        url = %22/project/%25s/webhook%22 %25 project.short_name%0A        res = self.app.get(url, follow_redirects=True)%0A        assert %22Sign in%22 in res.data, res.data%0A%0A    @with_context%0A    def test_webhook_handler_auth(self):%0A        %22%22%22Test WEBHOOK view works for authenticated not owner.%22%22%22%0A        self.register()%0A        user = user_repo.get(1)%0A        project = ProjectFactory.create(owner=user)%0A        self.signout()%0A        res = self.register(name=%22juan%22)%0A        url = %22/project/%25s/webhook%22 %25 project.short_name%0A        res = self.app.get(url)%0A        assert res.status_code == 403, res.status_code%0A%0A    @with_context%0A    def test_webhook_handler_owner(self):%0A        %22%22%22Test WEBHOOK view works for owner.%22%22%22%0A        self.register()%0A        user = user_repo.get(1)%0A        project = ProjectFactory.create(owner=user)%0A        url = %22/project/%25s/webhook%22 %25 project.short_name%0A        res = self.app.get(url)%0A        assert res.status_code == 200, res.status_code%0A        assert %22Created%22 in res.data%0A        assert %22Payload%22 in res.data%0A

Add tests.