annotate tests/testDocument.py @ 91:6a61c02f2156

Add deletion of CWEs
author Benoît Allard <benoit.allard@greenbone.net>
date Thu, 09 Oct 2014 16:03:04 +0200
parents 95c79e518204
children
rev   line source
75
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
1 # -*- encoding: utf-8 -*-
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
2 # Description:
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
3 # Short Description
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
4 #
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
5 # Authors:
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
6 # BenoƮt Allard <benoit.allard@greenbone.net>
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
7 #
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
8 # Copyright:
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
9 # Copyright (C) 2014 Greenbone Networks GmbH
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
10 #
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
11 # This program is free software; you can redistribute it and/or
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
12 # modify it under the terms of the GNU General Public License
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
13 # as published by the Free Software Foundation; either version 2
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
14 # of the License, or (at your option) any later version.
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
15 #
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
16 # This program is distributed in the hope that it will be useful,
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
19 # GNU General Public License for more details.
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
20 #
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
21 # You should have received a copy of the GNU General Public License
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
22 # along with this program; if not, write to the Free Software
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
23 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
24
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
25 from .utils import TestCase
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
26
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
27 class TestTracking(TestCase):
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
28
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
29 def createTracking(self, id_):
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
30 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': ''})
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
31
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
32 def testCreateTracking(self):
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
33 rv = self.createDoc('Title', 'Type')
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
34 self.assertEqual(rv.status_code, 200)
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
35 rv = self.createTracking('5')
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
36 self.assertEqual(rv.status_code, 302)
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
37
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
38 def testCreateEditDelRev(self):
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
39 rv = self.createDoc('Title', 'Type')
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
40 self.assertEqual(rv.status_code, 200)
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
41 rv = self.createTracking('5')
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
42 self.assertEqual(rv.status_code, 302)
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
43
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
44 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'})
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
45 self.assertEqual(rv.status_code, 302)
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
46
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
47 rv = self.app.post('/document/revision/0/edit', data={'number': '0.1', 'date': '2014-10-09T08:57:52+00:00', 'description': "First Revision"})
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
48 self.assertEqual(rv.status_code, 302)
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
49
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
50 rv = self.app.post('/document/revision/0/del')
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
51 self.assertEqual(rv.status_code, 302)
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
52
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
53
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
54 class testDocument(TestCase):
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
55
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
56 def testCreateEditDelNote(self):
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
57 rv = self.createDoc('Title', 'Type')
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
58 self.assertEqual(rv.status_code, 200)
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
59
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
60 rv = self.app.post('/document/note/add', data={'type': 'General', 'ordinal': '1', 'title': '', 'audience': '', 'note': 'Note content'})
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
61 self.assertEqual(rv.status_code, 302)
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
62
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
63 rv = self.app.post('/document/note/1/edit', data={'type': 'General', 'ordinal': '5', 'title': 'title', 'audience': '', 'note': 'Note content'})
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
64 self.assertEqual(rv.status_code, 302)
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
65
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
66 rv = self.app.post('/document/note/5/del')
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
67 self.assertEqual(rv.status_code, 302)
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
68
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
69
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
70 def testCreateEditDelRef(self):
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
71 rv = self.createDoc('Title', 'Type')
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
72 self.assertEqual(rv.status_code, 200)
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
73
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
74 rv = self.app.post('/document/reference/add', data={'type': '', 'url': "https://example.com", 'description': "DOT com"})
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
75 self.assertEqual(rv.status_code, 302)
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
76
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
77 rv = self.app.post('/document/reference/0/edit', data={'type': 'External', 'url': "https://example.com", 'description': "example DOT com"})
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
78 self.assertEqual(rv.status_code, 302)
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
79
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
80 rv = self.app.post('/document/reference/0/del')
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
81 self.assertEqual(rv.status_code, 302)
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
82
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
83
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
84 def testCreateEditDelAck(self):
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
85 rv = self.createDoc('Title', 'Type')
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
86 self.assertEqual(rv.status_code, 200)
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
87
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
88 rv = self.app.post('/document/acknowledgment/add', data={'names': "Antu Sanadi, Veerendra G.G", 'organizations': "SecPod Technologies Pvt. Ltd", 'description': "", 'url': ""})
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
89 self.assertEqual(rv.status_code, 302)
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
90
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
91 rv = self.app.post('/document/acknowledgment/0/edit', data={'names': "Antu Sanadi", 'organizations': "SecPod Technologies Pvt. Ltd", 'description': "Thanks !", 'url': ""})
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
92 self.assertEqual(rv.status_code, 302)
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
93
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
94 rv = self.app.post('/document/acknowledgment/0/del')
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
95 self.assertEqual(rv.status_code, 302)
95c79e518204 Add tests
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff changeset
96

http://farol.wald.intevation.org