75
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
1 # -*- encoding: utf-8 -*- |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
2 # Description: |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
3 # Short Description |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
4 # |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
5 # Authors: |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
6 # BenoƮt Allard <benoit.allard@greenbone.net> |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
7 # |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
8 # Copyright: |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
9 # Copyright (C) 2014 Greenbone Networks GmbH |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
10 # |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
11 # This program is free software; you can redistribute it and/or |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
12 # modify it under the terms of the GNU General Public License |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
13 # as published by the Free Software Foundation; either version 2 |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
14 # of the License, or (at your option) any later version. |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
15 # |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
16 # This program is distributed in the hope that it will be useful, |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
19 # GNU General Public License for more details. |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
20 # |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
21 # You should have received a copy of the GNU General Public License |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
22 # along with this program; if not, write to the Free Software |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
23 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
24 |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
25 from .utils import TestCase |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
26 |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
27 class TestTracking(TestCase): |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
28 |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
29 def createTracking(self, id_): |
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': ''}) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
31 |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
32 def testCreateTracking(self): |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
33 rv = self.createDoc('Title', 'Type') |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
34 self.assertEqual(rv.status_code, 200) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
35 rv = self.createTracking('5') |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
36 self.assertEqual(rv.status_code, 302) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
37 |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
38 def testCreateEditDelRev(self): |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
39 rv = self.createDoc('Title', 'Type') |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
40 self.assertEqual(rv.status_code, 200) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
41 rv = self.createTracking('5') |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
42 self.assertEqual(rv.status_code, 302) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
43 |
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'}) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
45 self.assertEqual(rv.status_code, 302) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
46 |
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"}) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
48 self.assertEqual(rv.status_code, 302) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
49 |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
50 rv = self.app.post('/document/revision/0/del') |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
51 self.assertEqual(rv.status_code, 302) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
52 |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
53 |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
54 class testDocument(TestCase): |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
55 |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
56 def testCreateEditDelNote(self): |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
57 rv = self.createDoc('Title', 'Type') |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
58 self.assertEqual(rv.status_code, 200) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
59 |
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'}) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
61 self.assertEqual(rv.status_code, 302) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
62 |
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'}) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
64 self.assertEqual(rv.status_code, 302) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
65 |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
66 rv = self.app.post('/document/note/5/del') |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
67 self.assertEqual(rv.status_code, 302) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
68 |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
69 |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
70 def testCreateEditDelRef(self): |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
71 rv = self.createDoc('Title', 'Type') |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
72 self.assertEqual(rv.status_code, 200) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
73 |
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"}) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
75 self.assertEqual(rv.status_code, 302) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
76 |
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"}) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
78 self.assertEqual(rv.status_code, 302) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
79 |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
80 rv = self.app.post('/document/reference/0/del') |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
81 self.assertEqual(rv.status_code, 302) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
82 |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
83 |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
84 def testCreateEditDelAck(self): |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
85 rv = self.createDoc('Title', 'Type') |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
86 self.assertEqual(rv.status_code, 200) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
87 |
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': ""}) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
89 self.assertEqual(rv.status_code, 302) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
90 |
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': ""}) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
92 self.assertEqual(rv.status_code, 302) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
93 |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
94 rv = self.app.post('/document/acknowledgment/0/del') |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
95 self.assertEqual(rv.status_code, 302) |
Benoît Allard <benoit.allard@greenbone.net>
parents:
diff
changeset
|
96 |