view tests/utils.py @ 90:2201d0ea0bf3

Add deletion of Involvements
author Benoît Allard <benoit.allard@greenbone.net>
date Thu, 09 Oct 2014 15:56:43 +0200
parents 4a9f23230eba
children
line wrap: on
line source
# -*- encoding: utf-8 -*-
# Description:
# Main test case class with some utilities
#
# Authors:
# BenoƮt Allard <benoit.allard@greenbone.net>
#
# Copyright:
# Copyright (C) 2014 Greenbone Networks GmbH
#
# 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 2
# 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, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.

import unittest

from farol import main
from farol.session import CVRFs

class TestCase(unittest.TestCase):

    def setUp(self):
        main.app.testing = True
        main.app.secret_key = 'test key'
        self.app = main.app.test_client()

    def createDoc(self, title, type_):
        rv = self.app.post('/new', data=dict(title=title, type=type_), follow_redirects=True)
        self.id = list(CVRFs.keys())[0]
        return rv

    def _assertIn(self, data, response, coding='utf-8'):
        self.assertIn(data, response.data.decode(coding))

http://farol.wald.intevation.org