Mercurial > farol
view tests/testDocument.py @ 139:584587a000a2
Propagate ProductID and GroupID updates in the whole document
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Mon, 27 Oct 2014 15:08:29 +0100 |
parents | 95c79e518204 |
children |
line wrap: on
line source
# -*- encoding: utf-8 -*- # Description: # Short Description # # 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. from .utils import TestCase class TestTracking(TestCase): def createTracking(self, id_): return self.app.post('/document/tracking/edit', data={'id': id_, 'id_aliases': '', 'status': 'Draft', 'version': '0.0', 'initial': '2014-10-09T08:50:51+00:00', 'current': '2014-10-09T08:50:51+00:00', 'gen_engine': '', 'gen_date': ''}) def testCreateTracking(self): rv = self.createDoc('Title', 'Type') self.assertEqual(rv.status_code, 200) rv = self.createTracking('5') self.assertEqual(rv.status_code, 302) def testCreateEditDelRev(self): rv = self.createDoc('Title', 'Type') self.assertEqual(rv.status_code, 200) rv = self.createTracking('5') self.assertEqual(rv.status_code, 302) rv = self.app.post('/document/revision/add', data={'number': '0.0', 'date': '2014-10-09T08:57:52+00:00', 'description': "First Revision", 'update_tracking': 'on'}) self.assertEqual(rv.status_code, 302) rv = self.app.post('/document/revision/0/edit', data={'number': '0.1', 'date': '2014-10-09T08:57:52+00:00', 'description': "First Revision"}) self.assertEqual(rv.status_code, 302) rv = self.app.post('/document/revision/0/del') self.assertEqual(rv.status_code, 302) class testDocument(TestCase): def testCreateEditDelNote(self): rv = self.createDoc('Title', 'Type') self.assertEqual(rv.status_code, 200) rv = self.app.post('/document/note/add', data={'type': 'General', 'ordinal': '1', 'title': '', 'audience': '', 'note': 'Note content'}) self.assertEqual(rv.status_code, 302) rv = self.app.post('/document/note/1/edit', data={'type': 'General', 'ordinal': '5', 'title': 'title', 'audience': '', 'note': 'Note content'}) self.assertEqual(rv.status_code, 302) rv = self.app.post('/document/note/5/del') self.assertEqual(rv.status_code, 302) def testCreateEditDelRef(self): rv = self.createDoc('Title', 'Type') self.assertEqual(rv.status_code, 200) rv = self.app.post('/document/reference/add', data={'type': '', 'url': "https://example.com", 'description': "DOT com"}) self.assertEqual(rv.status_code, 302) rv = self.app.post('/document/reference/0/edit', data={'type': 'External', 'url': "https://example.com", 'description': "example DOT com"}) self.assertEqual(rv.status_code, 302) rv = self.app.post('/document/reference/0/del') self.assertEqual(rv.status_code, 302) def testCreateEditDelAck(self): rv = self.createDoc('Title', 'Type') self.assertEqual(rv.status_code, 200) rv = self.app.post('/document/acknowledgment/add', data={'names': "Antu Sanadi, Veerendra G.G", 'organizations': "SecPod Technologies Pvt. Ltd", 'description': "", 'url': ""}) self.assertEqual(rv.status_code, 302) rv = self.app.post('/document/acknowledgment/0/edit', data={'names': "Antu Sanadi", 'organizations': "SecPod Technologies Pvt. Ltd", 'description': "Thanks !", 'url': ""}) self.assertEqual(rv.status_code, 302) rv = self.app.post('/document/acknowledgment/0/del') self.assertEqual(rv.status_code, 302)