benoit@75: # -*- encoding: utf-8 -*- benoit@75: # Description: benoit@75: # Short Description benoit@75: # benoit@75: # Authors: benoit@75: # BenoƮt Allard benoit@75: # benoit@75: # Copyright: benoit@75: # Copyright (C) 2014 Greenbone Networks GmbH benoit@75: # benoit@75: # This program is free software; you can redistribute it and/or benoit@75: # modify it under the terms of the GNU General Public License benoit@75: # as published by the Free Software Foundation; either version 2 benoit@75: # of the License, or (at your option) any later version. benoit@75: # benoit@75: # This program is distributed in the hope that it will be useful, benoit@75: # but WITHOUT ANY WARRANTY; without even the implied warranty of benoit@75: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the benoit@75: # GNU General Public License for more details. benoit@75: # benoit@75: # You should have received a copy of the GNU General Public License benoit@75: # along with this program; if not, write to the Free Software benoit@75: # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. benoit@75: benoit@75: from .utils import TestCase benoit@75: benoit@75: class TestTracking(TestCase): benoit@75: benoit@75: def createTracking(self, id_): benoit@75: 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': ''}) benoit@75: benoit@75: def testCreateTracking(self): benoit@75: rv = self.createDoc('Title', 'Type') benoit@75: self.assertEqual(rv.status_code, 200) benoit@75: rv = self.createTracking('5') benoit@75: self.assertEqual(rv.status_code, 302) benoit@75: benoit@75: def testCreateEditDelRev(self): benoit@75: rv = self.createDoc('Title', 'Type') benoit@75: self.assertEqual(rv.status_code, 200) benoit@75: rv = self.createTracking('5') benoit@75: self.assertEqual(rv.status_code, 302) benoit@75: benoit@75: 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'}) benoit@75: self.assertEqual(rv.status_code, 302) benoit@75: benoit@75: rv = self.app.post('/document/revision/0/edit', data={'number': '0.1', 'date': '2014-10-09T08:57:52+00:00', 'description': "First Revision"}) benoit@75: self.assertEqual(rv.status_code, 302) benoit@75: benoit@75: rv = self.app.post('/document/revision/0/del') benoit@75: self.assertEqual(rv.status_code, 302) benoit@75: benoit@75: benoit@75: class testDocument(TestCase): benoit@75: benoit@75: def testCreateEditDelNote(self): benoit@75: rv = self.createDoc('Title', 'Type') benoit@75: self.assertEqual(rv.status_code, 200) benoit@75: benoit@75: rv = self.app.post('/document/note/add', data={'type': 'General', 'ordinal': '1', 'title': '', 'audience': '', 'note': 'Note content'}) benoit@75: self.assertEqual(rv.status_code, 302) benoit@75: benoit@75: rv = self.app.post('/document/note/1/edit', data={'type': 'General', 'ordinal': '5', 'title': 'title', 'audience': '', 'note': 'Note content'}) benoit@75: self.assertEqual(rv.status_code, 302) benoit@75: benoit@75: rv = self.app.post('/document/note/5/del') benoit@75: self.assertEqual(rv.status_code, 302) benoit@75: benoit@75: benoit@75: def testCreateEditDelRef(self): benoit@75: rv = self.createDoc('Title', 'Type') benoit@75: self.assertEqual(rv.status_code, 200) benoit@75: benoit@75: rv = self.app.post('/document/reference/add', data={'type': '', 'url': "https://example.com", 'description': "DOT com"}) benoit@75: self.assertEqual(rv.status_code, 302) benoit@75: benoit@75: rv = self.app.post('/document/reference/0/edit', data={'type': 'External', 'url': "https://example.com", 'description': "example DOT com"}) benoit@75: self.assertEqual(rv.status_code, 302) benoit@75: benoit@75: rv = self.app.post('/document/reference/0/del') benoit@75: self.assertEqual(rv.status_code, 302) benoit@75: benoit@75: benoit@75: def testCreateEditDelAck(self): benoit@75: rv = self.createDoc('Title', 'Type') benoit@75: self.assertEqual(rv.status_code, 200) benoit@75: benoit@75: rv = self.app.post('/document/acknowledgment/add', data={'names': "Antu Sanadi, Veerendra G.G", 'organizations': "SecPod Technologies Pvt. Ltd", 'description': "", 'url': ""}) benoit@75: self.assertEqual(rv.status_code, 302) benoit@75: benoit@75: rv = self.app.post('/document/acknowledgment/0/edit', data={'names': "Antu Sanadi", 'organizations': "SecPod Technologies Pvt. Ltd", 'description': "Thanks !", 'url': ""}) benoit@75: self.assertEqual(rv.status_code, 302) benoit@75: benoit@75: rv = self.app.post('/document/acknowledgment/0/del') benoit@75: self.assertEqual(rv.status_code, 302) benoit@75: