benoit@0: # -*- encoding: utf-8 -*- benoit@0: # Description: benoit@0: # Main test case class with some utilities benoit@0: # benoit@0: # Authors: benoit@0: # BenoƮt Allard benoit@0: # benoit@0: # Copyright: benoit@0: # Copyright (C) 2014 Greenbone Networks GmbH benoit@0: # benoit@0: # This program is free software; you can redistribute it and/or benoit@0: # modify it under the terms of the GNU General Public License benoit@0: # as published by the Free Software Foundation; either version 2 benoit@0: # of the License, or (at your option) any later version. benoit@0: # benoit@0: # This program is distributed in the hope that it will be useful, benoit@0: # but WITHOUT ANY WARRANTY; without even the implied warranty of benoit@0: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the benoit@0: # GNU General Public License for more details. benoit@0: # benoit@0: # You should have received a copy of the GNU General Public License benoit@0: # along with this program; if not, write to the Free Software benoit@0: # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. benoit@0: benoit@0: import unittest benoit@0: benoit@0: from farol import main benoit@0: from farol.session import CVRFs benoit@0: benoit@0: class TestCase(unittest.TestCase): benoit@0: benoit@0: def setUp(self): benoit@0: main.app.testing = True benoit@0: main.app.secret_key = 'test key' benoit@0: self.app = main.app.test_client() benoit@0: benoit@0: def createDoc(self, title, type_): benoit@0: rv = self.app.post('/new', data=dict(title=title, type=type_), follow_redirects=True) benoit@0: self.id = list(CVRFs.keys())[0] benoit@0: return rv benoit@0: benoit@0: def _assertIn(self, data, response, coding='utf-8'): benoit@0: self.assertIn(data, response.data.decode(coding)) benoit@0: