Mercurial > farol
annotate tests/testBranches.py @ 171:62c482ae1755
Prepare the 1.1.0 release
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Mon, 05 Jan 2015 12:35:14 +0100 |
parents | c00f20bd90ba |
children |
rev | line source |
---|---|
0 | 1 # -*- encoding: utf-8 -*- |
2 # Description: | |
3 # Short Description | |
4 # | |
5 # Authors: | |
6 # BenoƮt Allard <benoit.allard@greenbone.net> | |
7 # | |
8 # Copyright: | |
9 # Copyright (C) 2014 Greenbone Networks GmbH | |
10 # | |
11 # This program is free software; you can redistribute it and/or | |
12 # modify it under the terms of the GNU General Public License | |
13 # as published by the Free Software Foundation; either version 2 | |
14 # of the License, or (at your option) any later version. | |
15 # | |
16 # This program is distributed in the hope that it will be useful, | |
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 # GNU General Public License for more details. | |
20 # | |
21 # You should have received a copy of the GNU General Public License | |
22 # along with this program; if not, write to the Free Software | |
23 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
24 | |
25 from .utils import TestCase | |
26 | |
27 class TestBranches(TestCase): | |
28 | |
29 def testAddBranch(self): | |
30 rv = self.createDoc('Title', 'Type') | |
31 self.assertEqual(rv.status_code, 200) | |
32 rv = self.app.post('/producttree/create') | |
33 rv = self.app.get('/producttree/branch/add') | |
79 | 34 rv = self.app.post('/producttree/branch/add', data=dict(type="Vendor", name="SecPod", parent="")) |
0 | 35 |
36 def testAddTwoBranch(self): | |
37 rv = self.createDoc('Title', 'Type') | |
38 self.assertEqual(rv.status_code, 200) | |
39 rv = self.app.post('/producttree/create') | |
40 rv = self.app.get('/producttree/branch/add') | |
41 rv = self.app.post('/producttree/branch/add', data=dict(type="Vendor", name="SecPod", parent="")) | |
42 rv = self.app.get('/producttree/branch/add') | |
43 self._assertIn('<option value="0"', rv) | |
44 rv = self.app.post('/producttree/branch/add', data=dict(type="Product Name", name="Saner", parent="0"), follow_redirects=True) | |
45 self._assertIn('<a href="/producttree/branch/0/0/edit">edit</a>', rv) | |
46 | |
47 def testEditBranch(self): | |
48 self.createDoc('Title', 'Type') | |
49 rv = self.app.post('/producttree/create', follow_redirects=True) | |
50 rv = self.app.post('/producttree/branch/add', data=dict(type="Vendor", name="SecPod", parent="")) | |
51 rv = self.app.get('/producttree/branch/0/edit') | |
52 rv = self.app.post('/producttree/branch/add', data=dict(type="Product Name", name="Saner", parent="0")) | |
53 rv = self.app.get('/producttree/branch/0/0/edit') | |
54 rv = self.app.post('/producttree/branch/0/0/edit', data=dict(type="Vendor", name="Other", parent=""), follow_redirects=True) | |
55 self._assertIn('<a href="/producttree/branch/1/edit">edit</a>', rv) | |
56 | |
80
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
79
diff
changeset
|
57 def testDeleteBranch(self): |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
79
diff
changeset
|
58 rv = self.createDoc('Title', 'Type') |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
79
diff
changeset
|
59 self.assertEqual(rv.status_code, 200) |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
79
diff
changeset
|
60 rv = self.app.post('/producttree/create') |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
79
diff
changeset
|
61 rv = self.app.get('/producttree/branch/add') |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
79
diff
changeset
|
62 rv = self.app.post('/producttree/branch/add', data=dict(type="Vendor", name="SecPod", parent="")) |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
79
diff
changeset
|
63 rv = self.app.post('/producttree/branch/0/del', follow_redirects=True) |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
79
diff
changeset
|
64 self.assertEqual(rv.status_code, 200) |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
79
diff
changeset
|
65 |