Mercurial > p > roundup > code
annotate test/test_admin.py @ 7549:73dfa9df9fb0
issue685275 - show retired/unretired items in roundup-admin
add pragma display_header to print headers for display command. Header
displays designator and retired/active status.
Add doc of pragma to affected commands.
Add test for code paths.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Fri, 14 Jul 2023 22:07:23 -0400 |
| parents | 793f4b63c538 |
| children | 978285986b2c |
| rev | line source |
|---|---|
|
5713
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
1 # |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
2 # Copyright (C) 2007 Stefan Seefeld |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
3 # All rights reserved. |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
4 # For license terms see the file COPYING.txt. |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
5 # |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
6 |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
7 from __future__ import print_function |
|
7204
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
8 import fileinput |
|
5713
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
9 import unittest, os, shutil, errno, sys, difflib, cgi, re |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
10 |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
11 from roundup.admin import AdminTool |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
12 |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
13 from .test_mysql import skip_mysql |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
14 from .test_postgresql import skip_postgresql |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
15 |
|
6178
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
16 #from roundup import instance |
|
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
17 |
|
6176
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
18 # https://stackoverflow.com/questions/4219717/how-to-assert-output-with-nosetest-unittest-in-python |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
19 # lightly modified |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
20 from contextlib import contextmanager |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
21 _py3 = sys.version_info[0] > 2 |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
22 if _py3: |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
23 from io import StringIO # py3 |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
24 else: |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
25 from StringIO import StringIO # py2 |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
26 |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
27 @contextmanager |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
28 def captured_output(): |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
29 new_out, new_err = StringIO(), StringIO() |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
30 old_out, old_err = sys.stdout, sys.stderr |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
31 try: |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
32 sys.stdout, sys.stderr = new_out, new_err |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
33 yield sys.stdout, sys.stderr |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
34 finally: |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
35 sys.stdout, sys.stderr = old_out, old_err |
|
5713
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
36 |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
37 def normalize_file(filename, skiplines = [ None ]): |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
38 # https://stackoverflow.com/questions/4710067/using-python-for-deleting-a-specific-line-in-a-file |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
39 |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
40 with open(filename, "r+") as f: |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
41 d = f.readlines() |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
42 f.seek(0) |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
43 for i in d: |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
44 for skip in skiplines: |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
45 if skip not in i: |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
46 f.write(i) |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
47 f.truncate() |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
48 |
|
7204
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
49 def replace_in_file(filename, original, replacement): |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
50 """replace text in a file. All occurances of original |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
51 will be replaced by replacement""" |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
52 |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
53 for line in fileinput.input(filename, inplace = 1): |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
54 print(line.replace(original, replacement)) |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
55 |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
56 fileinput.close() |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
57 |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
58 def find_in_file(filename, regexp): |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
59 """search for regexp in file. |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
60 If not found return false. If found return match. |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
61 """ |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
62 with open(filename) as f: |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
63 contents = f.read() |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
64 |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
65 m = re.search(regexp, contents, re.MULTILINE) |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
66 |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
67 if not m: return False |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
68 |
|
7205
1a3d4703c7d6
Fix for python2. m[0] -> m.group(0)
John Rouillard <rouilj@ieee.org>
parents:
7204
diff
changeset
|
69 return m.group(0) |
|
7204
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
70 |
|
5713
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
71 class AdminTest(object): |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
72 |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
73 backend = None |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
74 |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
75 def setUp(self): |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
76 self.dirname = '_test_admin' |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
77 |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
78 def tearDown(self): |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
79 try: |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
80 shutil.rmtree(self.dirname) |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
81 except OSError as error: |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
82 if error.errno not in (errno.ENOENT, errno.ESRCH): raise |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
83 |
|
6176
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
84 def install_init(self, type="classic", |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
85 settings="mail_domain=example.com," + |
|
6177
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
86 "mail_host=localhost," + |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
87 "tracker_web=http://test/," + |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
88 "rdbms_name=rounduptest," + |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
89 "rdbms_user=rounduptest," + |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
90 "rdbms_password=rounduptest," + |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
91 "rdbms_template=template0" |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
92 ): |
|
6176
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
93 ''' install tracker with settings for required config.ini settings. |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
94 ''' |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
95 |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
96 admin=AdminTool() |
|
6178
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
97 admin.force = True # force it to nuke existing tracker |
|
6176
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
98 |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
99 # Run under context manager to suppress output of help text. |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
100 with captured_output() as (out, err): |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
101 sys.argv=['main', '-i', self.dirname, 'install', |
|
6176
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
102 type, self.backend, settings ] |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
103 ret = admin.main() |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
104 self.assertEqual(ret, 0) |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
105 |
|
6178
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
106 # nuke any existing database (mysql/postgreql) |
|
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
107 # possible method in case admin.force doesn't work |
|
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
108 #tracker = instance.open(self.dirname) |
|
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
109 #if tracker.exists(): |
|
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
110 # tracker.nuke() |
|
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
111 |
|
6176
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
112 # initialize tracker with initial_data.py. Put password |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
113 # on cli so I don't have to respond to prompting. |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
114 sys.argv=['main', '-i', self.dirname, 'initialise', 'admin'] |
|
6178
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
115 admin.force = True # force it to nuke existing database |
|
6176
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
116 ret = admin.main() |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
117 self.assertEqual(ret, 0) |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
118 |
|
6178
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
119 |
|
7182
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
120 def testBasicInteractive(self): |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
121 # first command is an error that should be handled |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
122 inputs = iter(["'quit", "quit"]) |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
123 |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
124 orig_input = AdminTool.my_input |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
125 |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
126 AdminTool.my_input = lambda _self, _prompt: next(inputs) |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
127 |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
128 self.install_init() |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
129 self.admin=AdminTool() |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
130 sys.argv=['main', '-i', self.dirname] |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
131 |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
132 with captured_output() as (out, err): |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
133 ret = self.admin.main() |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
134 |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
135 out = out.getvalue().strip() |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
136 |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
137 print(ret) |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
138 self.assertTrue(ret == 0) |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
139 expected = 'ready for input.\nType "help" for help.' |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
140 self.assertEqual(expected, out[-1*len(expected):]) |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
141 |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
142 inputs = iter(["list user", "quit"]) |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
143 |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
144 AdminTool.my_input = lambda _self, _prompt: next(inputs) |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
145 |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
146 with captured_output() as (out, err): |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
147 ret = self.admin.main() |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
148 |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
149 out = out.getvalue().strip() |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
150 |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
151 print(ret) |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
152 self.assertTrue(ret == 0) |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
153 expected = 'help.\n 1: admin\n 2: anonymous' |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
154 self.assertEqual(expected, out[-1*len(expected):]) |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
155 |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
156 |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
157 AdminTool.my_input = orig_input |
|
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
158 |
|
6181
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
159 def testGet(self): |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
160 ''' Note the tests will fail if you run this under pdb. |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
161 the context managers capture the pdb prompts and this screws |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
162 up the stdout strings with (pdb) prefixed to the line. |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
163 ''' |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
164 self.install_init() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
165 self.admin=AdminTool() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
166 |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
167 with captured_output() as (out, err): |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
168 sys.argv=['main', '-i', self.dirname, 'create', 'issue', |
|
6181
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
169 'title="foo bar"', 'assignedto=admin' ] |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
170 ret = self.admin.main() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
171 |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
172 out = out.getvalue().strip() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
173 print(out) |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
174 self.assertEqual(out, '1') |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
175 |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
176 self.admin=AdminTool() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
177 with captured_output() as (out, err): |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
178 sys.argv=['main', '-i', self.dirname, 'create', 'issue', |
|
6181
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
179 'title="bar foo bar"', 'assignedto=anonymous', |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
180 'superseder=1'] |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
181 ret = self.admin.main() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
182 |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
183 self.assertEqual(ret, 0) |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
184 out = out.getvalue().strip() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
185 print(out) |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
186 self.assertEqual(out, '2') |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
187 |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
188 self.admin=AdminTool() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
189 with captured_output() as (out, err): |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
190 sys.argv=['main', '-i', self.dirname, 'get', 'assignedto', |
|
6181
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
191 'issue2' ] |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
192 ret = self.admin.main() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
193 |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
194 self.assertEqual(ret, 0) |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
195 out = out.getvalue().strip() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
196 err = err.getvalue().strip() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
197 self.assertEqual(out, '2') |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
198 self.assertEqual(len(err), 0) |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
199 |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
200 self.admin=AdminTool() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
201 with captured_output() as (out, err): |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
202 sys.argv=['main', '-i', self.dirname, 'get', 'superseder', |
|
6181
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
203 'issue2' ] |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
204 ret = self.admin.main() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
205 |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
206 self.assertEqual(ret, 0) |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
207 out = out.getvalue().strip() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
208 err = err.getvalue().strip() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
209 self.assertEqual(out, "['1']") |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
210 self.assertEqual(len(err), 0) |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
211 |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
212 self.admin=AdminTool() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
213 with captured_output() as (out, err): |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
214 sys.argv=['main', '-i', self.dirname, 'get', 'title', 'issue1'] |
|
6181
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
215 ret = self.admin.main() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
216 |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
217 self.assertEqual(ret, 0) |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
218 out = out.getvalue().strip() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
219 err = err.getvalue().strip() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
220 self.assertEqual(out, '"foo bar"') ## why is capture inserting "?? |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
221 self.assertEqual(len(err), 0) |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
222 |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
223 self.admin=AdminTool() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
224 with captured_output() as (out, err): |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
225 sys.argv=['main', '-i', self.dirname, 'get', 'tile', 'issue1'] |
|
6181
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
226 ret = self.admin.main() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
227 |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
228 expected_err = 'Error: no such issue property "tile"' |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
229 |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
230 self.assertEqual(ret, 1) |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
231 out = out.getvalue().strip() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
232 err = err.getvalue().strip() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
233 self.assertEqual(out.index(expected_err), 0) |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
234 self.assertEqual(len(err), 0) |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
235 |
| 6199 | 236 self.admin=AdminTool() |
| 237 with captured_output() as (out, err): | |
| 238 sys.argv=['main', '-i', self.dirname, 'get', 'title', 'issue'] | |
| 239 ret = self.admin.main() | |
| 240 | |
| 241 expected_err = 'Error: "issue" not a node designator' | |
| 242 | |
| 243 self.assertEqual(ret, 1) | |
| 244 out = out.getvalue().strip() | |
| 245 err = err.getvalue().strip() | |
| 246 self.assertEqual(out.index(expected_err), 0) | |
| 247 self.assertEqual(len(err), 0) | |
| 248 | |
|
5713
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
249 def testInit(self): |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
250 self.admin=AdminTool() |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
251 sys.argv=['main', '-i', self.dirname, 'install', 'classic', self.backend] |
|
5713
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
252 ret = self.admin.main() |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
253 print(ret) |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
254 self.assertTrue(ret == 0) |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
255 self.assertTrue(os.path.isfile(self.dirname + "/config.ini")) |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
256 self.assertTrue(os.path.isfile(self.dirname + "/schema.py")) |
|
5762
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
257 |
|
7392
bd6523c84a95
Fix test failure caused by making genconfig trackerless
John Rouillard <rouilj@ieee.org>
parents:
7254
diff
changeset
|
258 self.admin=AdminTool() |
|
bd6523c84a95
Fix test failure caused by making genconfig trackerless
John Rouillard <rouilj@ieee.org>
parents:
7254
diff
changeset
|
259 with captured_output() as (out, err): |
|
bd6523c84a95
Fix test failure caused by making genconfig trackerless
John Rouillard <rouilj@ieee.org>
parents:
7254
diff
changeset
|
260 sys.argv=['main', '-i', '/tmp/noSuchDirectory/nodir', 'install', 'classic', self.backend] |
|
bd6523c84a95
Fix test failure caused by making genconfig trackerless
John Rouillard <rouilj@ieee.org>
parents:
7254
diff
changeset
|
261 ret = self.admin.main() |
|
bd6523c84a95
Fix test failure caused by making genconfig trackerless
John Rouillard <rouilj@ieee.org>
parents:
7254
diff
changeset
|
262 |
|
bd6523c84a95
Fix test failure caused by making genconfig trackerless
John Rouillard <rouilj@ieee.org>
parents:
7254
diff
changeset
|
263 out = out.getvalue().strip() |
|
bd6523c84a95
Fix test failure caused by making genconfig trackerless
John Rouillard <rouilj@ieee.org>
parents:
7254
diff
changeset
|
264 print(ret) |
|
bd6523c84a95
Fix test failure caused by making genconfig trackerless
John Rouillard <rouilj@ieee.org>
parents:
7254
diff
changeset
|
265 print(out) |
|
bd6523c84a95
Fix test failure caused by making genconfig trackerless
John Rouillard <rouilj@ieee.org>
parents:
7254
diff
changeset
|
266 self.assertEqual(ret, 1) |
|
bd6523c84a95
Fix test failure caused by making genconfig trackerless
John Rouillard <rouilj@ieee.org>
parents:
7254
diff
changeset
|
267 self.assertIn('Error: Instance home parent directory ' |
|
bd6523c84a95
Fix test failure caused by making genconfig trackerless
John Rouillard <rouilj@ieee.org>
parents:
7254
diff
changeset
|
268 '"/tmp/noSuchDirectory" does not exist', out) |
|
bd6523c84a95
Fix test failure caused by making genconfig trackerless
John Rouillard <rouilj@ieee.org>
parents:
7254
diff
changeset
|
269 |
|
5762
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
270 def testInitWithConfig_ini(self): |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
271 from roundup.configuration import CoreConfig |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
272 self.admin=AdminTool() |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
273 sys.argv=['main', '-i', self.dirname, 'install', 'classic', self.backend] |
|
5762
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
274 # create a config_ini.ini file in classic template |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
275 templates=self.admin.listTemplates() |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
276 config_ini_content = "[mail]\n# comment\ndebug = SendMail.LOG\n" |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
277 config_ini_path = templates['classic']['path'] + '/config_ini.ini' |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
278 config_ini_file = open(config_ini_path, "w") |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
279 config_ini_file.write(config_ini_content) |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
280 config_ini_file.close() |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
281 |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
282 try: |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
283 ret = self.admin.main() |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
284 finally: |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
285 try: |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
286 # ignore file not found |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
287 os.remove(config_ini_path) |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
288 except OSError as e: # FileNotFound exception under py3 |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
289 if e.errno == 2: |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
290 pass |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
291 else: |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
292 raise |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
293 |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
294 print(ret) |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
295 self.assertTrue(ret == 0) |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
296 self.assertTrue(os.path.isfile(self.dirname + "/config.ini")) |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
297 self.assertTrue(os.path.isfile(self.dirname + "/schema.py")) |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
298 config=CoreConfig(self.dirname) |
|
b76be13e027e
issue2551029: Jinja2 template install error.
John Rouillard <rouilj@ieee.org>
parents:
5713
diff
changeset
|
299 self.assertEqual(config['MAIL_DEBUG'], self.dirname + "/SendMail.LOG") |
|
6176
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
300 |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
301 def testFind(self): |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
302 ''' Note the tests will fail if you run this under pdb. |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
303 the context managers capture the pdb prompts and this screws |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
304 up the stdout strings with (pdb) prefixed to the line. |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
305 ''' |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
306 self.admin=AdminTool() |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
307 self.install_init() |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
308 |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
309 with captured_output() as (out, err): |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
310 sys.argv=['main', '-i', self.dirname, 'create', 'issue', |
|
6176
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
311 'title="foo bar"', 'assignedto=admin' ] |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
312 ret = self.admin.main() |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
313 |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
314 out = out.getvalue().strip() |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
315 print(out) |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
316 self.assertEqual(out, '1') |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
317 |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
318 self.admin=AdminTool() |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
319 with captured_output() as (out, err): |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
320 sys.argv=['main', '-i', self.dirname, 'create', 'issue', |
|
6176
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
321 'title="bar foo bar"', 'assignedto=anonymous' ] |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
322 ret = self.admin.main() |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
323 |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
324 out = out.getvalue().strip() |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
325 print(out) |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
326 self.assertEqual(out, '2') |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
327 |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
328 self.admin=AdminTool() |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
329 with captured_output() as (out, err): |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
330 sys.argv=['main', '-i', self.dirname, 'find', 'issue', |
|
6176
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
331 'assignedto=1'] |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
332 ret = self.admin.main() |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
333 |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
334 out = out.getvalue().strip() |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
335 print(out) |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
336 self.assertEqual(out, "['1']") |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
337 |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
338 # Reopen the db closed by previous filter call |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
339 self.admin=AdminTool() |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
340 with captured_output() as (out, err): |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
341 ''' 1,2 should return all entries that have assignedto |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
342 either admin or anonymous |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
343 ''' |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
344 sys.argv=['main', '-i', self.dirname, 'find', 'issue', |
|
6176
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
345 'assignedto=1,2'] |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
346 ret = self.admin.main() |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
347 |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
348 out = out.getvalue().strip() |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
349 print(out) |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
350 # out can be "['2', '1']" or "['1', '2']" |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
351 # so eval to real list so Equal can do a list compare |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
352 self.assertEqual(sorted(eval(out)), ['1', '2']) |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
353 |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
354 # Reopen the db closed by previous filter call |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
355 self.admin=AdminTool() |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
356 with captured_output() as (out, err): |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
357 ''' 1,2 should return all entries that have assignedto |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
358 either admin or anonymous |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
359 ''' |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
360 sys.argv=['main', '-i', self.dirname, 'find', 'issue', |
|
6176
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
361 'assignedto=admin,anonymous'] |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
362 ret = self.admin.main() |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
363 |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
364 out = out.getvalue().strip() |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
365 print(out) |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
366 # out can be "['2', '1']" or "['1', '2']" |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
367 # so eval to real list so Equal can do a list compare |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
368 self.assertEqual(sorted(eval(out)), ['1', '2']) |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
369 |
|
6188
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
370 def testGenconfigUpdate(self): |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
371 ''' Note the tests will fail if you run this under pdb. |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
372 the context managers capture the pdb prompts and this screws |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
373 up the stdout strings with (pdb) prefixed to the line. |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
374 ''' |
|
7182
0c6617db0b97
Add testing interactive mode to roundup_admin. remove redundant imports
John Rouillard <rouilj@ieee.org>
parents:
7168
diff
changeset
|
375 import filecmp |
|
6188
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
376 |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
377 self.admin=AdminTool() |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
378 self.install_init() |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
379 |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
380 with captured_output() as (out, err): |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
381 sys.argv=['main', '-i', self.dirname, 'genconfig'] |
|
6188
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
382 ret = self.admin.main() |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
383 |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
384 out = out.getvalue().strip() |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
385 print(out) |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
386 expected = "Not enough arguments supplied" |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
387 self.assertTrue(expected in out) |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
388 |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
389 # Reopen the db closed by previous call |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
390 self.admin=AdminTool() |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
391 |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
392 with captured_output() as (out, err): |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
393 sys.argv=['main', '-i', self.dirname, 'genconfig', |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
394 self.dirname + "/config2.ini"] |
|
6188
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
395 ret = self.admin.main() |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
396 |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
397 out = out.getvalue().strip() |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
398 print(out) |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
399 # FIXME get better successful test later. |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
400 expected = "" |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
401 self.assertTrue(expected in out) |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
402 self.assertTrue(os.path.isfile(self.dirname + "/config2.ini")) |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
403 # Files aren't the same. Lines need to be removed. |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
404 # like user, web, backend etc. Genconfig generates a file |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
405 # to be customized. |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
406 #self.assertTrue(filecmp.cmp(self.dirname + "/config2.ini", |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
407 # self.dirname + "/config.ini")) |
|
6188
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
408 |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
409 # Reopen the db closed by previous call |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
410 self.admin=AdminTool() |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
411 |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
412 with captured_output() as (out, err): |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
413 sys.argv=['main', '-i', self.dirname, 'update', |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
414 self.dirname + "/foo2.ini"] |
|
6188
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
415 ret = self.admin.main() |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
416 |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
417 out = out.getvalue().strip() |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
418 print(out) |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
419 # FIXME get better successful test later. |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
420 expected = "" |
|
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
421 self.assertTrue(expected in out) |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
422 self.assertTrue(os.path.isfile(self.dirname + "/foo2.ini")) |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
423 |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
424 # Autogenerated date header is different. Remove it |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
425 # so filecmp passes. |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
426 normalize_file(self.dirname + "/foo2.ini", |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
427 [ '# Autogenerated at' ]) |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
428 normalize_file(self.dirname + "/config.ini", |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
429 [ '# Autogenerated at' ]) |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
430 |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
431 self.assertTrue(filecmp.cmp(self.dirname + "/config.ini", |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
432 self.dirname + "/foo2.ini")) |
|
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
433 |
|
7204
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
434 def testUpdateconfigPbkdf2(self): |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
435 ''' Note the tests will fail if you run this under pdb. |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
436 the context managers capture the pdb prompts and this screws |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
437 up the stdout strings with (pdb) prefixed to the line. |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
438 ''' |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
439 import filecmp |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
440 |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
441 self.admin=AdminTool() |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
442 self.install_init() |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
443 |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
444 with captured_output() as (out, err): |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
445 sys.argv=['main', '-i', self.dirname, 'updateconfig', |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
446 self.dirname + "/config2.ini"] |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
447 ret = self.admin.main() |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
448 |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
449 out = out.getvalue().strip() |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
450 print(out) |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
451 self.assertEqual(out, "") |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
452 self.assertTrue(os.path.isfile(self.dirname + "/config2.ini")) |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
453 # Autogenerated date header is different. Remove it |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
454 # so filecmp passes. |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
455 normalize_file(self.dirname + "/config2.ini", |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
456 [ '# Autogenerated at' ]) |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
457 normalize_file(self.dirname + "/config.ini", |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
458 [ '# Autogenerated at' ]) |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
459 |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
460 self.assertTrue(filecmp.cmp(self.dirname + "/config.ini", |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
461 self.dirname + "/config2.ini")) |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
462 |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
463 # Reopen the db closed by previous call |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
464 self.admin=AdminTool() |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
465 |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
466 ### test replacement of old default value |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
467 replace_in_file(self.dirname + "/config.ini", |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
468 "= 2000000", "= 10000") |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
469 with captured_output() as (out, err): |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
470 sys.argv=['main', '-i', self.dirname, 'update', |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
471 self.dirname + "/config2.ini"] |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
472 ret = self.admin.main() |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
473 |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
474 out = out.getvalue().strip() |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
475 print(out) |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
476 expected = "from old default of 10000 to new default of 2000000." |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
477 |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
478 self.assertIn(expected, out) |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
479 self.assertTrue(os.path.isfile(self.dirname + "/config2.ini")) |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
480 self.assertEqual(find_in_file(self.dirname + "/config2.ini", |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
481 "^password_.*= 2000000$"), |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
482 "password_pbkdf2_default_rounds = 2000000") |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
483 |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
484 # Reopen the db closed by previous call |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
485 self.admin=AdminTool() |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
486 |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
487 ### test replacement of too small value |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
488 replace_in_file(self.dirname + "/config.ini", |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
489 "= 10000", "= 10001") |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
490 with captured_output() as (out, err): |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
491 sys.argv=['main', '-i', self.dirname, 'update', |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
492 self.dirname + "/config2.ini"] |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
493 ret = self.admin.main() |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
494 |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
495 out = out.getvalue().strip() |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
496 print(out) |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
497 expected = ("Update 'password_pbkdf2_default_rounds' to a number " |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
498 "equal to or larger\nthan 2000000.") |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
499 |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
500 self.assertIn(expected, out) |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
501 self.assertTrue(os.path.isfile(self.dirname + "/config2.ini")) |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
502 self.assertEqual(find_in_file(self.dirname + "/config2.ini", |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
503 "^password_.*= 10001$"), |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
504 "password_pbkdf2_default_rounds = 10001") |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
505 |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
506 |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
507 # Reopen the db closed by previous call |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
508 self.admin=AdminTool() |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
509 |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
510 ### test no action if value is large enough |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
511 replace_in_file(self.dirname + "/config.ini", |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
512 "= 10001", "= 2000001") |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
513 with captured_output() as (out, err): |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
514 sys.argv=['main', '-i', self.dirname, 'update', |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
515 self.dirname + "/config2.ini"] |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
516 ret = self.admin.main() |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
517 |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
518 out = out.getvalue().strip() |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
519 print(out) |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
520 expected = "" |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
521 |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
522 self.assertEqual(expected, out) |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
523 self.assertTrue(os.path.isfile(self.dirname + "/config2.ini")) |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
524 self.assertEqual(find_in_file(self.dirname + "/config2.ini", |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
525 "^password_.*= 2000001$"), |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
526 "password_pbkdf2_default_rounds = 2000001") |
|
ccb0e566e0be
Add missing space in message; add tests; update .po
John Rouillard <rouilj@ieee.org>
parents:
7182
diff
changeset
|
527 |
|
6188
32ebffbae49a
Setup basic genconfig and updateconfig tests.
John Rouillard <rouilj@ieee.org>
parents:
6186
diff
changeset
|
528 |
|
6186
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
529 def testCliParse(self): |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
530 ''' Note the tests will fail if you run this under pdb. |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
531 the context managers capture the pdb prompts and this screws |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
532 up the stdout strings with (pdb) prefixed to the line. |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
533 ''' |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
534 self.admin=AdminTool() |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
535 self.install_init() |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
536 |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
537 # test partial command lookup fin -> calls find |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
538 |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
539 with captured_output() as (out, err): |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
540 ''' assignedto is not a valid property=value, so |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
541 report error. |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
542 ''' |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
543 sys.argv=['main', '-i', self.dirname, 'fin', 'issue', |
|
6186
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
544 'assignedto=1'] |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
545 ret = self.admin.main() |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
546 |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
547 out = out.getvalue().strip() |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
548 print(out) |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
549 expected="[ '1' ]" |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
550 self.assertTrue(expected, out) |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
551 |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
552 # Reopen the db closed by previous call |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
553 self.admin=AdminTool() |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
554 # test multiple matches |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
555 with captured_output() as (out, err): |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
556 ''' assignedto is not a valid property=value, so |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
557 report error. |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
558 ''' |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
559 sys.argv=['main', '-i', self.dirname, 'f', 'issue', |
|
6186
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
560 'assignedto'] |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
561 ret = self.admin.main() |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
562 |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
563 out = out.getvalue().strip() |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
564 print(out) |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
565 expected='Multiple commands match "f": filter, find' |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
566 self.assertEqual(expected, out) |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
567 |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
568 # Reopen the db closed by previous call |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
569 self.admin=AdminTool() |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
570 # test broken command lookup xyzzy is not a valid command |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
571 with captured_output() as (out, err): |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
572 ''' assignedto is not a valid property=value, so |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
573 report error. |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
574 ''' |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
575 sys.argv=['main', '-i', self.dirname, 'xyzzy', 'issue', |
|
6186
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
576 'assignedto'] |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
577 ret = self.admin.main() |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
578 |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
579 out = out.getvalue().strip() |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
580 print(out) |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
581 expected=('Unknown command "xyzzy" ' |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
582 '("help commands" for a list)') |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
583 self.assertEqual(expected, out) |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
584 |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
585 # Reopen the db closed by previous call |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
586 self.admin=AdminTool() |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
587 # test for keyword=value check |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
588 with captured_output() as (out, err): |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
589 ''' assignedto is not a valid property=value, so |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
590 report error. |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
591 ''' |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
592 sys.argv=['main', '-i', self.dirname, 'find', 'issue', |
|
6186
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
593 'assignedto'] |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
594 ret = self.admin.main() |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
595 |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
596 out = out.getvalue().strip() |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
597 print(out) |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
598 expected='Error: argument "assignedto" not propname=value' |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
599 self.assertTrue(expected in out) |
|
81babf5a4494
Test for cli. Command partial match, Bad command, bad args.
John Rouillard <rouilj@ieee.org>
parents:
6181
diff
changeset
|
600 |
|
6177
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
601 def testFilter(self): |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
602 ''' Note the tests will fail if you run this under pdb. |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
603 the context managers capture the pdb prompts and this screws |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
604 up the stdout strings with (pdb) prefixed to the line. |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
605 ''' |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
606 self.admin=AdminTool() |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
607 self.install_init() |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
608 |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
609 with captured_output() as (out, err): |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
610 sys.argv=['main', '-i', self.dirname, 'create', 'issue', |
|
6177
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
611 'title="foo bar"', 'assignedto=admin' ] |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
612 ret = self.admin.main() |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
613 |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
614 out = out.getvalue().strip() |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
615 print(out) |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
616 self.assertEqual(out, '1') |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
617 |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
618 self.admin=AdminTool() |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
619 with captured_output() as (out, err): |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
620 sys.argv=['main', '-i', self.dirname, 'create', 'issue', |
|
6177
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
621 'title="bar foo bar"', 'assignedto=anonymous' ] |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
622 ret = self.admin.main() |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
623 |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
624 out = out.getvalue().strip() |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
625 print(out) |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
626 self.assertEqual(out, '2') |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
627 |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
628 |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
629 # Reopen the db closed by previous filter call |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
630 # test string - one results, one value, substring |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
631 self.admin=AdminTool() |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
632 with captured_output() as (out, err): |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
633 sys.argv=['main', '-i', self.dirname, 'filter', 'user', |
|
6177
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
634 'username=admin'] |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
635 ret = self.admin.main() |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
636 |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
637 out = out.getvalue().strip() |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
638 print(out) |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
639 self.assertEqual(out, "['1']") |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
640 |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
641 # Reopen the db closed by previous filter call |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
642 # test string - two results, two values, substring |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
643 self.admin=AdminTool() |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
644 with captured_output() as (out, err): |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
645 ''' a,n should return all entries that have an a and n |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
646 so admin or anonymous |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
647 ''' |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
648 sys.argv=['main', '-i', self.dirname, 'filter', 'user', |
|
6177
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
649 'username=a,n'] |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
650 ret = self.admin.main() |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
651 |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
652 out = out.getvalue().strip() |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
653 print(out) |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
654 # out can be "['2', '1']" or "['1', '2']" |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
655 # so eval to real list so Equal can do a list compare |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
656 self.assertEqual(sorted(eval(out)), ['1', '2']) |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
657 |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
658 # Reopen the db closed by previous filter call |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
659 # test string - one result, two values, substring |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
660 self.admin=AdminTool() |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
661 with captured_output() as (out, err): |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
662 ''' a,y should return all entries that have an a and y |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
663 so anonymous |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
664 ''' |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
665 sys.argv=['main', '-i', self.dirname, 'filter', 'user', |
|
6177
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
666 'username=a,y'] |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
667 ret = self.admin.main() |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
668 |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
669 out = out.getvalue().strip() |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
670 print(out) |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
671 self.assertEqual(out, "['2']") |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
672 |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
673 # Reopen the db closed by previous filter call |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
674 # test string - no results |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
675 self.admin=AdminTool() |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
676 with captured_output() as (out, err): |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
677 ''' will return empty set as admin!=anonymous |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
678 ''' |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
679 sys.argv=['main', '-i', self.dirname, 'filter', 'user', |
|
6177
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
680 'username=admin,anonymous'] |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
681 ret = self.admin.main() |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
682 |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
683 out = out.getvalue().strip() |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
684 print(out) |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
685 self.assertEqual(out, "[]") |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
686 |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
687 # Reopen the db closed by previous filter call |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
688 # test link using ids |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
689 self.admin=AdminTool() |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
690 with captured_output() as (out, err): |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
691 sys.argv=['main', '-i', self.dirname, 'filter', 'issue', |
|
6177
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
692 'assignedto=1,2'] |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
693 ret = self.admin.main() |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
694 |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
695 out = out.getvalue().strip() |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
696 print(out) |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
697 self.assertEqual(sorted(eval(out)), ['1', '2']) |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
698 |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
699 # Reopen the db closed by previous filter call |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
700 # test link using names |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
701 self.admin=AdminTool() |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
702 with captured_output() as (out, err): |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
703 ''' will return empty set as admin!=anonymous |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
704 ''' |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
705 sys.argv=['main', '-i', self.dirname, 'filter', 'issue', |
|
6177
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
706 'assignedto=admin,anonymous'] |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
707 ret = self.admin.main() |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
708 |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
709 out = out.getvalue().strip() |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
710 print(out) |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
711 self.assertEqual(sorted(eval(out)), ['1', '2']) |
|
41907e1f9c3f
Fix postgres/mysql testing; test filter.
John Rouillard <rouilj@ieee.org>
parents:
6176
diff
changeset
|
712 |
|
6250
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
713 # Reopen the db closed by previous filter call |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
714 # |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
715 # case: transitive property valid match |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
716 self.admin=AdminTool() |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
717 with captured_output() as (out, err): |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
718 sys.argv=['main', '-i', self.dirname, 'filter', 'issue', |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
719 'assignedto.roles=Anonymous'] |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
720 ret = self.admin.main() |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
721 |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
722 out = out.getvalue().strip() |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
723 print(out) |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
724 self.assertEqual(out, "['2']") |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
725 |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
726 # Reopen the db closed by previous filter call |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
727 # self.admin=AdminTool() |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
728 # case: transitive propery invalid prop |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
729 self.admin=AdminTool() |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
730 with captured_output() as (out, err): |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
731 ''' assignedto is not a valid property=value, so |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
732 report error. |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
733 ''' |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
734 sys.argv=['main', '-i', self.dirname, 'filter', 'issue', |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
735 'assignedto.badprop=Admin'] |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
736 ret = self.admin.main() |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
737 |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
738 out = out.getvalue().strip() |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
739 expected='Error: Class user has no property badprop in assignedto.badprop.' |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
740 print(out[0:len(expected)]) |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
741 self.assertEqual(expected, out[0:len(expected)]) |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
742 |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
743 # Reopen the db closed by previous filter call |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
744 # |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
745 # case: transitive property invalid match |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
746 self.admin=AdminTool() |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
747 with captured_output() as (out, err): |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
748 sys.argv=['main', '-i', self.dirname, |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
749 'filter', 'issue', |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
750 'assignedto.username=NoNAme'] |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
751 ret = self.admin.main() |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
752 |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
753 out = out.getvalue().strip() |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
754 print("me: " + out) |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
755 print(err.getvalue().strip()) |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
756 self.assertEqual(out, "[]") |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
757 |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
758 # Reopen the db closed by previous filter call |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
759 # |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
760 # case: transitive property invalid match |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
761 self.admin=AdminTool() |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
762 with captured_output() as (out, err): |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
763 sys.argv=['main', '-i', self.dirname, '-c', |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
764 'filter', 'issue', |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
765 'assignedto.username=NoNAme'] |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
766 ret = self.admin.main() |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
767 |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
768 out = out.getvalue().strip() |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
769 print("me: " + out) |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
770 print(err.getvalue().strip()) |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
771 self.assertEqual(out, "") |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
772 |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
773 # Reopen the db closed by previous filter call |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
774 # |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
775 # case: transitive property invalid match |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
776 self.admin=AdminTool() |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
777 with captured_output() as (out, err): |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
778 sys.argv=['main', '-i', self.dirname, '-c', |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
779 'filter', 'issue', |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
780 'assignedto.username=A'] |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
781 ret = self.admin.main() |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
782 |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
783 out = out.getvalue().strip() |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
784 print("me: " + out) |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
785 print(err.getvalue().strip()) |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
786 self.assertEqual(out, "1,2") |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
787 |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
788 # Reopen the db closed by previous filter call |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
789 # |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
790 # case: transitive property invalid match |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
791 self.admin=AdminTool() |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
792 with captured_output() as (out, err): |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
793 sys.argv=['main', '-i', self.dirname, '-s', |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
794 'filter', 'issue', |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
795 'assignedto.username=A'] |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
796 ret = self.admin.main() |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
797 |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
798 out = out.getvalue().strip() |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
799 print("me: " + out) |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
800 print(err.getvalue().strip()) |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
801 self.assertEqual(out, "1 2") |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
802 |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
803 # Reopen the db closed by previous filter call |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
804 # |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
805 # case: transitive property invalid match |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
806 self.admin=AdminTool() |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
807 with captured_output() as (out, err): |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
808 sys.argv=['main', '-i', self.dirname, '-S', ':', |
|
6251
b303db7f384f
Test designator code path
John Rouillard <rouilj@ieee.org>
parents:
6250
diff
changeset
|
809 '-d', 'filter', 'issue', |
|
6250
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
810 'assignedto.username=A'] |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
811 ret = self.admin.main() |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
812 |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
813 out = out.getvalue().strip() |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
814 print("me: " + out) |
|
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
815 print(err.getvalue().strip()) |
|
6251
b303db7f384f
Test designator code path
John Rouillard <rouilj@ieee.org>
parents:
6250
diff
changeset
|
816 self.assertEqual(out, "issue1:issue2") |
|
6250
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
817 |
|
7254
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
818 def testPragma_reopen_tracker(self): |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
819 """test that _reopen_tracker works. |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
820 """ |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
821 if self.backend not in ['anydbm']: |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
822 self.skipTest("For speed only run test with anydbm.") |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
823 |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
824 orig_input = AdminTool.my_input |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
825 |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
826 # must set verbose to see _reopen_tracker hidden setting. |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
827 # and to get "Reopening tracker" verbose log output |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
828 inputs = iter(["pragma verbose=true", "pragma list", "quit"]) |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
829 AdminTool.my_input = lambda _self, _prompt: next(inputs) |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
830 |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
831 self.install_init() |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
832 self.admin=AdminTool() |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
833 sys.argv=['main', '-i', self.dirname] |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
834 |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
835 with captured_output() as (out, err): |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
836 ret = self.admin.main() |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
837 |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
838 out = out.getvalue().strip().split('\n') |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
839 |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
840 print(ret) |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
841 self.assertTrue(ret == 0) |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
842 expected = ' _reopen_tracker=False' |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
843 self.assertIn(expected, out) |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
844 self.assertIn('descriptions...', out[-1]) |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
845 self.assertNotIn('Reopening tracker', out) |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
846 |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
847 # ----- |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
848 inputs = iter(["pragma verbose=true", "pragma _reopen_tracker=True", |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
849 "pragma list", "quit"]) |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
850 AdminTool.my_input = lambda _self, _prompt: next(inputs) |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
851 |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
852 self.install_init() |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
853 self.admin=AdminTool() |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
854 sys.argv=['main', '-i', self.dirname] |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
855 |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
856 with captured_output() as (out, err): |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
857 ret = self.admin.main() |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
858 |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
859 out = out.getvalue().strip().split('\n') |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
860 |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
861 print(ret) |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
862 self.assertTrue(ret == 0) |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
863 self.assertEqual('Reopening tracker', out[2]) |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
864 expected = ' _reopen_tracker=True' |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
865 self.assertIn(expected, out) |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
866 |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
867 # ----- |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
868 AdminTool.my_input = orig_input |
|
af870e295b46
add test for pragma _reopen_tracker
John Rouillard <rouilj@ieee.org>
parents:
7252
diff
changeset
|
869 |
|
7252
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
870 def testPragma(self): |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
871 """Uses interactive mode since pragmas only apply when using multiple |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
872 commands. |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
873 """ |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
874 if self.backend not in ['anydbm']: |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
875 self.skipTest("For speed only run test with anydbm.") |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
876 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
877 orig_input = AdminTool.my_input |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
878 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
879 for i in ["oN", "1", "yeS", "True"]: |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
880 inputs = iter(["pragma verbose=%s" % i, "pragma list", "quit"]) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
881 AdminTool.my_input = lambda _self, _prompt: next(inputs) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
882 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
883 self.install_init() |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
884 self.admin=AdminTool() |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
885 sys.argv=['main', '-i', self.dirname] |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
886 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
887 with captured_output() as (out, err): |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
888 ret = self.admin.main() |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
889 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
890 out = out.getvalue().strip().split('\n') |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
891 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
892 print(ret) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
893 self.assertTrue(ret == 0) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
894 expected = ' verbose=True' |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
895 self.assertIn(expected, out) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
896 self.assertIn('descriptions...', out[-1]) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
897 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
898 # ----- |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
899 for i in ["oFf", "0", "NO", "FalSe"]: |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
900 inputs = iter(["pragma verbose=true", "pragma verbose=%s" % i, |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
901 "pragma list", "quit"]) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
902 AdminTool.my_input = lambda _self, _prompt: next(inputs) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
903 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
904 self.install_init() |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
905 self.admin=AdminTool() |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
906 sys.argv=['main', '-i', self.dirname] |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
907 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
908 with captured_output() as (out, err): |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
909 ret = self.admin.main() |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
910 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
911 out = out.getvalue().strip().split('\n') |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
912 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
913 print(ret) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
914 self.assertTrue(ret == 0) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
915 expected = ' verbose=False' |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
916 self.assertIn(expected, out) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
917 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
918 # ----- test syntax errors |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
919 inputs = iter(["pragma", "pragma arg", |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
920 "pragma foo=3","quit"]) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
921 AdminTool.my_input = lambda _self, _prompt: next(inputs) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
922 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
923 self.install_init() |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
924 self.admin=AdminTool() |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
925 sys.argv=['main', '-i', self.dirname] |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
926 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
927 with captured_output() as (out, err): |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
928 ret = self.admin.main() |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
929 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
930 out = out.getvalue().strip().split('\n') |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
931 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
932 print(ret) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
933 self.assertTrue(ret == 0) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
934 expected = 'Error: Not enough arguments supplied' |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
935 self.assertIn(expected, out) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
936 expected = 'Error: Argument must be setting=value, was given: arg.' |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
937 self.assertIn(expected, out) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
938 expected = 'Error: Unknown setting foo.' |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
939 self.assertIn(expected, out) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
940 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
941 # ----- |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
942 inputs = iter(["pragma verbose=foo", "quit"]) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
943 AdminTool.my_input = lambda _self, _prompt: next(inputs) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
944 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
945 self.install_init() |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
946 self.admin=AdminTool() |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
947 sys.argv=['main', '-i', self.dirname] |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
948 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
949 with captured_output() as (out, err): |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
950 ret = self.admin.main() |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
951 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
952 out = out.getvalue().strip().split('\n') |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
953 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
954 print(ret) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
955 self.assertTrue(ret == 0) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
956 expected = 'Error: Incorrect value for boolean setting verbose: foo.' |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
957 self.assertIn(expected, out) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
958 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
959 # ----- |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
960 inputs = iter(["pragma verbose=on", "pragma _inttest=5", |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
961 "pragma list", "quit"]) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
962 AdminTool.my_input = lambda _self, _prompt: next(inputs) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
963 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
964 self.install_init() |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
965 self.admin=AdminTool() |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
966 sys.argv=['main', '-i', self.dirname] |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
967 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
968 with captured_output() as (out, err): |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
969 ret = self.admin.main() |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
970 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
971 out = out.getvalue().strip().split('\n') |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
972 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
973 print(ret) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
974 self.assertTrue(ret == 0) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
975 expected = ' _inttest=5' |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
976 self.assertIn(expected, out) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
977 self.assertIn('descriptions...', out[-1]) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
978 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
979 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
980 # ----- |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
981 inputs = iter(["pragma verbose=on", "pragma _inttest=fred", |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
982 "pragma list", "quit"]) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
983 AdminTool.my_input = lambda _self, _prompt: next(inputs) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
984 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
985 self.install_init() |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
986 self.admin=AdminTool() |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
987 sys.argv=['main', '-i', self.dirname] |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
988 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
989 with captured_output() as (out, err): |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
990 ret = self.admin.main() |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
991 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
992 out = out.getvalue().strip().split('\n') |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
993 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
994 print(ret) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
995 self.assertTrue(ret == 0) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
996 expected = 'Error: Incorrect value for integer setting _inttest: fred.' |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
997 self.assertIn(expected, out) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
998 self.assertIn('descriptions...', out[-1]) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
999 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1000 # ----- |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1001 inputs = iter(["pragma indexer_backend=whoosh", "pragma list", |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1002 "quit"]) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1003 AdminTool.my_input = lambda _self, _prompt: next(inputs) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1004 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1005 self.install_init() |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1006 self.admin=AdminTool() |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1007 sys.argv=['main', '-i', self.dirname] |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1008 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1009 with captured_output() as (out, err): |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1010 ret = self.admin.main() |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1011 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1012 out = out.getvalue().strip().split('\n') |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1013 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1014 print(ret) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1015 expected = ' indexer_backend=whoosh' |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1016 self.assertIn(expected, out) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1017 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1018 # ----- |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1019 inputs = iter(["pragma _floattest=4.5", "quit"]) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1020 AdminTool.my_input = lambda _self, _prompt: next(inputs) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1021 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1022 self.install_init() |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1023 self.admin=AdminTool() |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1024 sys.argv=['main', '-i', self.dirname] |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1025 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1026 with captured_output() as (out, err): |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1027 ret = self.admin.main() |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1028 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1029 out = out.getvalue().strip().split('\n') |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1030 |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1031 print(ret) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1032 expected = 'Error: Internal error: pragma can not handle values of type: float' |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1033 self.assertIn(expected, out) |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1034 |
|
7543
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1035 |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1036 # ----- |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1037 inputs = iter(["pragma display_protected=yes", |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1038 "display user1", |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1039 "quit"]) |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1040 AdminTool.my_input = lambda _self, _prompt: next(inputs) |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1041 |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1042 self.install_init() |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1043 self.admin=AdminTool() |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1044 sys.argv=['main', '-i', self.dirname] |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1045 |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1046 with captured_output() as (out, err): |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1047 ret = self.admin.main() |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1048 |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1049 out = out.getvalue().strip() |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1050 |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1051 print(ret) |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1052 expected = '\n*creation: ' |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1053 self.assertIn(expected, out) |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1054 |
|
7252
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1055 # ----- |
|
9c067ed4568b
add pragma command to roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7205
diff
changeset
|
1056 AdminTool.my_input = orig_input |
|
6250
95183d73ac64
issue2550522 - add transitive searching to filter in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
6199
diff
changeset
|
1057 |
|
7395
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1058 def testReindex(self): |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1059 ''' Note the tests will fail if you run this under pdb. |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1060 the context managers capture the pdb prompts and this screws |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1061 up the stdout strings with (pdb) prefixed to the line. |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1062 ''' |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1063 self.install_init() |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1064 |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1065 # create an issue |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1066 self.admin=AdminTool() |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1067 sys.argv=['main', '-i', self.dirname, 'create', 'issue', |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1068 'title="foo bar"', 'assignedto=admin' ] |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1069 ret = self.admin.main() |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1070 |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1071 # reindex everything |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1072 self.admin=AdminTool() |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1073 with captured_output() as (out, err): |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1074 sys.argv=['main', '-i', self.dirname, 'reindex'] |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1075 ret = self.admin.main() |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1076 out = out.getvalue().strip() |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1077 print(len(out)) |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1078 print(repr(out)) |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1079 # make sure priority is being reindexed |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1080 self.assertIn('Reindex priority 40%', out) |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1081 |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1082 |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1083 # reindex whole class |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1084 self.admin=AdminTool() |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1085 with captured_output() as (out, err): |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1086 sys.argv=['main', '-i', self.dirname, 'reindex', 'issue'] |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1087 ret = self.admin.main() |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1088 |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1089 out = out.getvalue().strip() |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1090 print(len(out)) |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1091 print(repr(out)) |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1092 self.assertEqual(out, |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1093 'Reindex issue 0% \rReindex issue 100% \rReindex issue done') |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1094 self.assertEqual(len(out), 170) |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1095 |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1096 # reindex one item |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1097 self.admin=AdminTool() |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1098 with captured_output() as (out, err): |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1099 sys.argv=['main', '-i', self.dirname, 'reindex', 'issue1'] |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1100 ret = self.admin.main() |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1101 |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1102 out = out.getvalue().strip() |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1103 print(len(out)) |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1104 print(repr(out)) |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1105 # no output when reindexing just one item |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1106 self.assertEqual(out, '') |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1107 |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1108 # reindex range |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1109 self.admin=AdminTool() |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1110 with captured_output() as (out, err): |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1111 sys.argv=['main', '-i', self.dirname, 'reindex', 'issue:1-4'] |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1112 ret = self.admin.main() |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1113 |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1114 out = out.getvalue().strip() |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1115 print(repr(out)) |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1116 self.assertIn('no such item "issue3"', out) |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1117 |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1118 # reindex bad class |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1119 self.admin=AdminTool() |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1120 with captured_output() as (out, err): |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1121 sys.argv=['main', '-i', self.dirname, 'reindex', 'issue1-4'] |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1122 ret = self.admin.main() |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1123 |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1124 out = out.getvalue().strip() |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1125 print(repr(out)) |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1126 self.assertIn('Error: no such class "issue1-4"', out) |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1127 |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1128 # reindex bad item |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1129 self.admin=AdminTool() |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1130 with captured_output() as (out, err): |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1131 sys.argv=['main', '-i', self.dirname, 'reindex', 'issue14'] |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1132 ret = self.admin.main() |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1133 |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1134 out = out.getvalue().strip() |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1135 print(repr(out)) |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1136 self.assertIn('Error: no such item "issue14"', out) |
|
312d52305583
- issue2551190 - Allow roundup-admin reindex to work in batches.
John Rouillard <rouilj@ieee.org>
parents:
7392
diff
changeset
|
1137 |
| 6199 | 1138 def disabletestHelpInitopts(self): |
| 1139 | |
| 1140 ''' Note the tests will fail if you run this under pdb. | |
| 1141 the context managers capture the pdb prompts and this screws | |
| 1142 up the stdout strings with (pdb) prefixed to the line. | |
| 1143 ''' | |
| 1144 self.install_init() | |
| 1145 self.admin=AdminTool() | |
| 1146 | |
| 1147 with captured_output() as (out, err): | |
| 1148 sys.argv=['main', '-i', self.dirname, 'help', 'initopts'] | |
| 1149 ret = self.admin.main() | |
| 1150 | |
| 1151 out = out.getvalue().strip() | |
| 1152 expected = [ | |
| 1153 'Templates: minimal, jinja2, classic, responsive, devel', | |
| 1154 'Back ends: anydbm, sqlite' | |
| 1155 ] | |
| 1156 print(out) | |
| 1157 self.assertTrue(expected[0] in out) | |
| 1158 self.assertTrue("Back ends:" in out) | |
| 1159 | |
|
6393
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1160 def testSecurity(self): |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1161 ''' Note the tests will fail if you run this under pdb. |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1162 the context managers capture the pdb prompts and this screws |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1163 up the stdout strings with (pdb) prefixed to the line. |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1164 ''' |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1165 self.install_init() |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1166 self.admin=AdminTool() |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1167 |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1168 with captured_output() as (out, err): |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1169 sys.argv=['main', '-i', self.dirname, 'security' ] |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1170 ret = self.admin.main() |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1171 |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1172 result = """New Web users get the Role "User" |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1173 New Email users get the Role "User" |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1174 Role "admin": |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1175 User may create everything (Create) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1176 User may edit everything (Edit) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1177 User may restore everything (Restore) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1178 User may retire everything (Retire) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1179 User may view everything (View) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1180 User may access the web interface (Web Access) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1181 User may access the rest interface (Rest Access) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1182 User may access the xmlrpc interface (Xmlrpc Access) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1183 User may manipulate user Roles through the web (Web Roles) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1184 User may use the email interface (Email Access) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1185 Role "anonymous": |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1186 User may access the web interface (Web Access) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1187 User is allowed to register new user (Register for "user" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1188 User is allowed to access issue (View for "issue" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1189 User is allowed to access file (View for "file" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1190 User is allowed to access msg (View for "msg" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1191 User is allowed to access keyword (View for "keyword" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1192 User is allowed to access priority (View for "priority" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1193 User is allowed to access status (View for "status" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1194 (Search for "user" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1195 Role "user": |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1196 User may access the web interface (Web Access) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1197 User may use the email interface (Email Access) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1198 User may access the rest interface (Rest Access) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1199 User may access the xmlrpc interface (Xmlrpc Access) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1200 User is allowed to access issue (View for "issue" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1201 User is allowed to edit issue (Edit for "issue" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1202 User is allowed to create issue (Create for "issue" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1203 User is allowed to access file (View for "file" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1204 User is allowed to edit file (Edit for "file" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1205 User is allowed to create file (Create for "file" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1206 User is allowed to access msg (View for "msg" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1207 User is allowed to edit msg (Edit for "msg" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1208 User is allowed to create msg (Create for "msg" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1209 User is allowed to access keyword (View for "keyword" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1210 User is allowed to edit keyword (Edit for "keyword" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1211 User is allowed to create keyword (Create for "keyword" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1212 User is allowed to access priority (View for "priority" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1213 User is allowed to access status (View for "status" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1214 (View for "user": ('id', 'organisation', 'phone', 'realname', 'timezone', 'username') only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1215 User is allowed to view their own user details (View for "user" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1216 User is allowed to edit their own user details (Edit for "user": ('username', 'password', 'address', 'realname', 'phone', 'organisation', 'alternate_addresses', 'queries', 'timezone') only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1217 User is allowed to view their own and public queries (View for "query" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1218 (Search for "query" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1219 User is allowed to edit their queries (Edit for "query" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1220 User is allowed to retire their queries (Retire for "query" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1221 User is allowed to restore their queries (Restore for "query" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1222 User is allowed to create queries (Create for "query" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1223 """ |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1224 print(out.getvalue()) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1225 |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1226 self.assertEqual(result, out.getvalue()) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1227 self.assertEqual(ret, 0) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1228 |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1229 def testSecurityInvalidAttribute(self): |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1230 ''' Test with an invalid attribute. |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1231 Note the tests will fail if you run this under pdb. |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1232 the context managers capture the pdb prompts and this screws |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1233 up the stdout strings with (pdb) prefixed to the line. |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1234 ''' |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1235 self.maxDiff = None # we want full diff |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1236 |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1237 self.install_init() |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1238 |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1239 # edit in an invalid attribute/property |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1240 with open(self.dirname + "/schema.py", "r+") as f: |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1241 d = f.readlines() |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1242 f.seek(0) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1243 for i in d: |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1244 if "organisation" in i: |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1245 i = i.replace("'id', 'organisation'","'id', 'organization'") |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1246 f.write(i) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1247 f.truncate() |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1248 |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1249 self.admin=AdminTool() |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1250 |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1251 with captured_output() as (out, err): |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1252 sys.argv=['main', '-i', self.dirname, 'security' ] |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1253 ret = self.admin.main() |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1254 |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1255 result = """New Web users get the Role "User" |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1256 New Email users get the Role "User" |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1257 Role "admin": |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1258 User may create everything (Create) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1259 User may edit everything (Edit) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1260 User may restore everything (Restore) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1261 User may retire everything (Retire) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1262 User may view everything (View) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1263 User may access the web interface (Web Access) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1264 User may access the rest interface (Rest Access) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1265 User may access the xmlrpc interface (Xmlrpc Access) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1266 User may manipulate user Roles through the web (Web Roles) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1267 User may use the email interface (Email Access) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1268 Role "anonymous": |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1269 User may access the web interface (Web Access) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1270 User is allowed to register new user (Register for "user" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1271 User is allowed to access issue (View for "issue" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1272 User is allowed to access file (View for "file" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1273 User is allowed to access msg (View for "msg" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1274 User is allowed to access keyword (View for "keyword" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1275 User is allowed to access priority (View for "priority" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1276 User is allowed to access status (View for "status" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1277 (Search for "user" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1278 Role "user": |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1279 User may access the web interface (Web Access) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1280 User may use the email interface (Email Access) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1281 User may access the rest interface (Rest Access) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1282 User may access the xmlrpc interface (Xmlrpc Access) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1283 User is allowed to access issue (View for "issue" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1284 User is allowed to edit issue (Edit for "issue" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1285 User is allowed to create issue (Create for "issue" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1286 User is allowed to access file (View for "file" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1287 User is allowed to edit file (Edit for "file" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1288 User is allowed to create file (Create for "file" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1289 User is allowed to access msg (View for "msg" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1290 User is allowed to edit msg (Edit for "msg" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1291 User is allowed to create msg (Create for "msg" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1292 User is allowed to access keyword (View for "keyword" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1293 User is allowed to edit keyword (Edit for "keyword" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1294 User is allowed to create keyword (Create for "keyword" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1295 User is allowed to access priority (View for "priority" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1296 User is allowed to access status (View for "status" only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1297 (View for "user": ('id', 'organization', 'phone', 'realname', 'timezone', 'username') only) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1298 |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1299 **Invalid properties for user: ['organization'] |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1300 |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1301 """ |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1302 print(out.getvalue()) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1303 |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1304 self.assertEqual(result, out.getvalue()) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1305 self.assertEqual(ret, 1) |
|
51a1a9b0f567
- issue2551062: AddPermission doesn't validate property names.
John Rouillard <rouilj@ieee.org>
parents:
6332
diff
changeset
|
1306 |
|
6181
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1307 def testSet(self): |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1308 ''' Note the tests will fail if you run this under pdb. |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1309 the context managers capture the pdb prompts and this screws |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1310 up the stdout strings with (pdb) prefixed to the line. |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1311 ''' |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1312 self.install_init() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1313 self.admin=AdminTool() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1314 |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1315 with captured_output() as (out, err): |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
1316 sys.argv=['main', '-i', self.dirname, 'create', 'issue', |
|
6181
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1317 'title="foo bar"', 'assignedto=admin' ] |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1318 ret = self.admin.main() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1319 |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1320 out = out.getvalue().strip() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1321 print(out) |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1322 self.assertEqual(out, '1') |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1323 |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1324 self.admin=AdminTool() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1325 with captured_output() as (out, err): |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
1326 sys.argv=['main', '-i', self.dirname, 'create', 'issue', |
|
6181
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1327 'title="bar foo bar"', 'assignedto=anonymous' ] |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1328 ret = self.admin.main() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1329 |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1330 out = out.getvalue().strip() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1331 print(out) |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1332 self.assertEqual(out, '2') |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1333 |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1334 self.admin=AdminTool() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1335 with captured_output() as (out, err): |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
1336 sys.argv=['main', '-i', self.dirname, 'set', 'issue2', 'title="new title"'] |
|
6181
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1337 ret = self.admin.main() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1338 |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1339 out = out.getvalue().strip() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1340 err = err.getvalue().strip() |
|
6332
6a6b4651be1f
Use server-side cursor for postgres in some cases
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6251
diff
changeset
|
1341 self.assertEqual(out, '') |
|
6a6b4651be1f
Use server-side cursor for postgres in some cases
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6251
diff
changeset
|
1342 self.assertEqual(err, '') |
|
6181
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1343 |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1344 self.admin=AdminTool() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1345 with captured_output() as (out, err): |
| 6199 | 1346 sys.argv=['main', '-i', self.dirname, 'set', 'issue2', |
| 1347 'tile="new title"'] | |
|
6181
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1348 ret = self.admin.main() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1349 |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1350 expected_err = "Error: 'tile' is not a property of issue" |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1351 |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1352 out = out.getvalue().strip() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1353 err = err.getvalue().strip() |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1354 self.assertEqual(out.index(expected_err), 0) |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1355 self.assertEqual(len(err), 0) |
|
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1356 |
| 6199 | 1357 self.admin=AdminTool() |
| 1358 with captured_output() as (out, err): | |
| 1359 sys.argv=['main', '-i', self.dirname, 'set', 'issue2'] | |
| 1360 ret = self.admin.main() | |
| 1361 | |
| 1362 expected_err = "Error: Not enough arguments supplied" | |
| 1363 | |
| 1364 out = out.getvalue().strip() | |
| 1365 err = err.getvalue().strip() | |
| 1366 self.assertEqual(out.index(expected_err), 0) | |
| 1367 self.assertEqual(len(err), 0) | |
| 1368 | |
| 1369 | |
| 1370 self.admin=AdminTool() | |
| 1371 with captured_output() as (out, err): | |
| 1372 sys.argv=['main', '-i', self.dirname, 'set', | |
| 1373 'issue2,issue1,issue', "status=1" ] | |
| 1374 ret = self.admin.main() | |
| 1375 | |
| 1376 expected_err = 'Error: "issue" not a node designator' | |
| 1377 | |
| 1378 out = out.getvalue().strip() | |
| 1379 err = err.getvalue().strip() | |
| 1380 self.assertEqual(out.index(expected_err), 0) | |
| 1381 self.assertEqual(len(err), 0) | |
| 1382 | |
| 1383 self.admin=AdminTool() | |
| 1384 with captured_output() as (out, err): | |
| 1385 sys.argv=['main', '-i', self.dirname, 'set', | |
| 1386 'issue2,issue1,user2', "status=1" ] | |
| 1387 ret = self.admin.main() | |
| 1388 | |
| 1389 expected_err = "Error: 'status' is not a property of user" | |
| 1390 | |
| 1391 out = out.getvalue().strip() | |
| 1392 err = err.getvalue().strip() | |
| 1393 print(out) | |
| 1394 print(expected_err) | |
| 1395 print(err) | |
| 1396 self.assertEqual(out.index(expected_err), 0) | |
| 1397 self.assertEqual(len(err), 0) | |
| 1398 | |
| 1399 self.admin=AdminTool() | |
| 1400 with captured_output() as (out, err): | |
| 1401 sys.argv=['main', '-i', self.dirname, 'set', | |
| 1402 'issue2,issue1,issue1000', "status=1" ] | |
| 1403 ret = self.admin.main() | |
| 1404 | |
| 1405 expected_err = 'Error: no such issue 1000' | |
| 1406 | |
| 1407 out = out.getvalue().strip() | |
| 1408 err = err.getvalue().strip() | |
| 1409 self.assertEqual(out.index(expected_err), 0) | |
| 1410 self.assertEqual(len(err), 0) | |
| 1411 | |
| 1412 def testSetOnClass(self): | |
| 1413 ''' Note the tests will fail if you run this under pdb. | |
| 1414 the context managers capture the pdb prompts and this screws | |
| 1415 up the stdout strings with (pdb) prefixed to the line. | |
| 1416 ''' | |
| 1417 self.install_init() | |
| 1418 | |
| 1419 self.admin=AdminTool() | |
| 1420 with captured_output() as (out, err): | |
| 1421 sys.argv=['main', '-i', self.dirname, 'create', 'issue', | |
| 1422 'title="foo bar"', 'assignedto=admin' ] | |
| 1423 ret = self.admin.main() | |
| 1424 | |
| 1425 out = out.getvalue().strip() | |
| 1426 print(out) | |
| 1427 self.assertEqual(out, '1') | |
| 1428 | |
| 1429 self.admin=AdminTool() | |
| 1430 with captured_output() as (out, err): | |
| 1431 sys.argv=['main', '-i', self.dirname, 'create', 'issue', | |
| 1432 'title="bar foo bar"', 'assignedto=anonymous' ] | |
| 1433 ret = self.admin.main() | |
| 1434 | |
| 1435 out = out.getvalue().strip() | |
| 1436 print(out) | |
| 1437 self.assertEqual(out, '2') | |
| 1438 | |
| 1439 # Run this test in a separate test. | |
| 1440 # It can cause a database timeout/resource | |
| 1441 # unavailable error for anydbm when run with other tests. | |
| 1442 # Not sure why. | |
| 1443 # Set assignedto=2 for all issues | |
| 1444 ## verify that issue 1 and 2 are assigned to user1 and user2 | |
| 1445 self.admin=AdminTool() | |
| 1446 with captured_output() as (out, err): | |
| 1447 sys.argv=['main', '-i', self.dirname, 'table', 'issue', | |
| 1448 'assignedto'] | |
| 1449 ret = self.admin.main() | |
| 1450 | |
| 1451 expected = "Assignedto\n1 \n2" | |
| 1452 out = out.getvalue().strip() | |
| 1453 err = err.getvalue().strip() | |
| 1454 self.assertEqual(out, expected) | |
| 1455 self.assertEqual(len(err), 0) | |
| 1456 self.admin=AdminTool() | |
| 1457 # do the set | |
| 1458 with captured_output() as (out, err): | |
| 1459 sys.argv=['main', '-i', self.dirname, 'set', 'issue', | |
| 1460 'assignedto=2'] | |
| 1461 ret = self.admin.main() | |
| 1462 | |
| 1463 expected_err = "" | |
| 1464 | |
| 1465 out = out.getvalue().strip() | |
| 1466 err = err.getvalue().strip() | |
|
6332
6a6b4651be1f
Use server-side cursor for postgres in some cases
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6251
diff
changeset
|
1467 self.assertEqual(out, '') |
|
6a6b4651be1f
Use server-side cursor for postgres in some cases
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6251
diff
changeset
|
1468 self.assertEqual(err, '') |
| 6199 | 1469 |
| 1470 ## verify that issue 1 and 2 are assigned to user2 and user2 | |
| 1471 self.admin=AdminTool() | |
| 1472 with captured_output() as (out, err): | |
| 1473 sys.argv=['main', '-i', self.dirname, 'table', 'issue', | |
| 1474 'assignedto'] | |
| 1475 ret = self.admin.main() | |
| 1476 | |
| 1477 expected = "Assignedto\n2 \n2" | |
| 1478 out = out.getvalue().strip() | |
| 1479 err = err.getvalue().strip() | |
| 1480 self.assertEqual(out, expected) | |
| 1481 self.assertEqual(len(err), 0) | |
|
6181
49f599f187e1
Add tests for get and set, clean up Specification test.
John Rouillard <rouilj@ieee.org>
parents:
6178
diff
changeset
|
1482 |
|
6176
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
1483 def testSpecification(self): |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
1484 ''' Note the tests will fail if you run this under pdb. |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
1485 the context managers capture the pdb prompts and this screws |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
1486 up the stdout strings with (pdb) prefixed to the line. |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
1487 ''' |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
1488 self.install_init() |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
1489 self.admin=AdminTool() |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
1490 |
|
6178
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
1491 spec= [ 'username: <roundup.hyperdb.String> (key property)', |
|
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
1492 'alternate_addresses: <roundup.hyperdb.String>', |
|
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
1493 'realname: <roundup.hyperdb.String>', |
|
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
1494 'roles: <roundup.hyperdb.String>', |
|
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
1495 'organisation: <roundup.hyperdb.String>', |
|
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
1496 'queries: <roundup.hyperdb.Multilink to "query">', |
|
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
1497 'phone: <roundup.hyperdb.String>', |
|
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
1498 'address: <roundup.hyperdb.String>', |
|
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
1499 'timezone: <roundup.hyperdb.String>', |
|
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
1500 'password: <roundup.hyperdb.Password>', |
|
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
1501 ] |
|
7543
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1502 |
|
6178
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
1503 |
|
6176
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
1504 with captured_output() as (out, err): |
|
6189
7458211ca6f3
Use self.dirname, add testing for genconfig/updateconfig
John Rouillard <rouilj@ieee.org>
parents:
6188
diff
changeset
|
1505 sys.argv=['main', '-i', self.dirname, 'specification', 'user'] |
|
6176
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
1506 ret = self.admin.main() |
|
d25638d1826c
Add roundup-admin filter command; fix bad doc example; add tests
John Rouillard <rouilj@ieee.org>
parents:
5762
diff
changeset
|
1507 |
|
6178
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
1508 outlist = out.getvalue().strip().split("\n") |
|
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
1509 print(outlist) |
|
227c05ce2d85
Nuke database on install and fix specification test
John Rouillard <rouilj@ieee.org>
parents:
6177
diff
changeset
|
1510 self.assertEqual(sorted(outlist), sorted(spec)) |
|
5713
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
1511 |
|
7543
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1512 # ----- |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1513 self.install_init() |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1514 self.admin=AdminTool() |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1515 |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1516 with captured_output() as (out, err): |
|
7546
534f8bdb8f94
Add -P pragma=value command line option to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7543
diff
changeset
|
1517 sys.argv=['main', '-i', self.dirname, '-P', |
|
534f8bdb8f94
Add -P pragma=value command line option to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7543
diff
changeset
|
1518 'display_protected=1', 'specification', 'user'] |
|
7543
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1519 ret = self.admin.main() |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1520 |
|
7546
534f8bdb8f94
Add -P pragma=value command line option to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7543
diff
changeset
|
1521 outlist = out.getvalue().strip().split('\n') |
|
7543
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1522 |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1523 protected = [ 'id: <roundup.hyperdb.String>', |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1524 'creation: <roundup.hyperdb.Date>', |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1525 'activity: <roundup.hyperdb.Date>', |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1526 'creator: <roundup.hyperdb.Link to "user">', |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1527 'actor: <roundup.hyperdb.Link to "user">'] |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1528 print(outlist) |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1529 self.assertEqual(sorted(outlist), sorted(spec + protected)) |
|
fc9daba984c0
- issue2551103 - add pragma 'display_protected' to roundup-admin.
John Rouillard <rouilj@ieee.org>
parents:
7395
diff
changeset
|
1530 |
|
6430
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1531 def testRetireRestore(self): |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1532 ''' Note the tests will fail if you run this under pdb. |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1533 the context managers capture the pdb prompts and this screws |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1534 up the stdout strings with (pdb) prefixed to the line. |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1535 ''' |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1536 # create user1 at id 3 |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1537 self.install_init() |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1538 self.admin=AdminTool() |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1539 with captured_output() as (out, err): |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1540 sys.argv=['main', '-i', self.dirname, 'create', 'user', |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1541 'username=user1', 'address=user1' ] |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1542 ret = self.admin.main() |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1543 |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1544 out = out.getvalue().strip() |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1545 print(out) |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1546 self.assertEqual(out, '3') |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1547 |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1548 # retire user1 at id 3 |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1549 self.admin=AdminTool() |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1550 with captured_output() as (out, err): |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1551 sys.argv=['main', '-i', self.dirname, 'retire', 'user3'] |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1552 ret = self.admin.main() |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1553 out = out.getvalue().strip() |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1554 print(out) |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1555 self.assertEqual(out, '') |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1556 |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1557 # create new user1 at id 4 - note need unique address to succeed. |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1558 self.admin=AdminTool() |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1559 with captured_output() as (out, err): |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1560 sys.argv=['main', '-i', self.dirname, 'create', 'user', |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1561 'username=user1', 'address=user1a' ] |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1562 ret = self.admin.main() |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1563 |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1564 out = out.getvalue().strip() |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1565 print(out) |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1566 self.assertEqual(out, '4') |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1567 |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1568 # fail to restore old user1 at id 3 |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1569 self.admin=AdminTool() |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1570 with captured_output() as (out, err): |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1571 sys.argv=['main', '-i', self.dirname, 'restore', 'user3'] |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1572 ret = self.admin.main() |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1573 out = out.getvalue().strip() |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1574 print(out) |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1575 self.assertIn('Error: Key property (username) of retired node clashes with existing one (user1)', out) |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1576 |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1577 # verify that user4 is listed |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1578 self.admin=AdminTool() |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1579 with captured_output() as (out, err): |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1580 sys.argv=['main', '-i', self.dirname, 'list', 'user'] |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1581 ret = self.admin.main() |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1582 out = out.getvalue().strip() |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1583 print(out) |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1584 expected="1: admin\n 2: anonymous\n 4: user1" |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1585 self.assertEqual(out, expected) |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1586 |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1587 # retire user4 |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1588 self.admin=AdminTool() |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1589 with captured_output() as (out, err): |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1590 sys.argv=['main', '-i', self.dirname, 'retire', 'user4'] |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1591 ret = self.admin.main() |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1592 out = out.getvalue().strip() |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1593 print(out) |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1594 self.assertEqual(out, '') |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1595 |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1596 # now we can restore user3 |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1597 self.admin=AdminTool() |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1598 with captured_output() as (out, err): |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1599 sys.argv=['main', '-i', self.dirname, 'restore', 'user3'] |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1600 ret = self.admin.main() |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1601 out = out.getvalue().strip() |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1602 print(out) |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1603 self.assertEqual(out, '') |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1604 |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1605 # verify that user3 is listed |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1606 self.admin=AdminTool() |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1607 with captured_output() as (out, err): |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1608 sys.argv=['main', '-i', self.dirname, 'list', 'user'] |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1609 ret = self.admin.main() |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1610 out = out.getvalue().strip() |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1611 print(out) |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1612 expected="1: admin\n 2: anonymous\n 3: user1" |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1613 self.assertEqual(out, expected) |
|
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1614 |
|
7547
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1615 # test show_retired pragma three cases: |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1616 # no - no retired items |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1617 # only - only retired items |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1618 # both - all items |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1619 |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1620 # verify that user4 only is listed |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1621 self.admin=AdminTool() |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1622 with captured_output() as (out, err): |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1623 sys.argv=['main', '-i', self.dirname, '-P', |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1624 'show_retired=only', 'list', 'user'] |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1625 ret = self.admin.main() |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1626 out = out.getvalue().strip() |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1627 print(out) |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1628 expected="4: user1" |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1629 self.assertEqual(out, expected) |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1630 |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1631 # verify that all users are shown |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1632 self.admin=AdminTool() |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1633 with captured_output() as (out, err): |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1634 sys.argv=['main', '-i', self.dirname, '-P', |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1635 'show_retired=both', 'list', 'user'] |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1636 ret = self.admin.main() |
|
7548
793f4b63c538
Fix test where postgres returned items in different order
John Rouillard <rouilj@ieee.org>
parents:
7547
diff
changeset
|
1637 out_list = sorted(out.getvalue().strip().split("\n")) |
|
7547
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1638 print(out) |
|
7548
793f4b63c538
Fix test where postgres returned items in different order
John Rouillard <rouilj@ieee.org>
parents:
7547
diff
changeset
|
1639 expected_list=sorted("1: admin\n 2: anonymous\n 3: user1\n 4: user1".split("\n")) |
|
793f4b63c538
Fix test where postgres returned items in different order
John Rouillard <rouilj@ieee.org>
parents:
7547
diff
changeset
|
1640 self.assertEqual(out_list, expected_list) |
|
7547
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1641 |
|
7549
73dfa9df9fb0
issue685275 - show retired/unretired items in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7548
diff
changeset
|
1642 # verify that active users are shown |
|
7547
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1643 self.admin=AdminTool() |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1644 with captured_output() as (out, err): |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1645 sys.argv=['main', '-i', self.dirname, '-P', |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1646 'show_retired=no', 'list', 'user'] |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1647 ret = self.admin.main() |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1648 out = out.getvalue().strip() |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1649 print(out) |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1650 expected="1: admin\n 2: anonymous\n 3: user1" |
|
c8c4514f4c3e
issue685275 - show retired/unretire commands
John Rouillard <rouilj@ieee.org>
parents:
7546
diff
changeset
|
1651 self.assertEqual(out, expected) |
|
6430
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1652 |
|
7549
73dfa9df9fb0
issue685275 - show retired/unretired items in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7548
diff
changeset
|
1653 # test display headers for retired/active |
|
73dfa9df9fb0
issue685275 - show retired/unretired items in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7548
diff
changeset
|
1654 self.admin=AdminTool() |
|
73dfa9df9fb0
issue685275 - show retired/unretired items in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7548
diff
changeset
|
1655 with captured_output() as (out, err): |
|
73dfa9df9fb0
issue685275 - show retired/unretired items in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7548
diff
changeset
|
1656 sys.argv=['main', '-i', self.dirname, '-P', |
|
73dfa9df9fb0
issue685275 - show retired/unretired items in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7548
diff
changeset
|
1657 'display_header=yes', 'display', 'user3,user4'] |
|
73dfa9df9fb0
issue685275 - show retired/unretired items in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7548
diff
changeset
|
1658 ret = self.admin.main() |
|
73dfa9df9fb0
issue685275 - show retired/unretired items in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7548
diff
changeset
|
1659 out = out.getvalue().strip() |
|
73dfa9df9fb0
issue685275 - show retired/unretired items in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7548
diff
changeset
|
1660 print(out) |
|
73dfa9df9fb0
issue685275 - show retired/unretired items in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7548
diff
changeset
|
1661 self.assertIn("[user3 (active)]\n", out) |
|
73dfa9df9fb0
issue685275 - show retired/unretired items in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7548
diff
changeset
|
1662 self.assertIn( "[user4 (retired)]\n", out) |
|
73dfa9df9fb0
issue685275 - show retired/unretired items in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7548
diff
changeset
|
1663 |
|
73dfa9df9fb0
issue685275 - show retired/unretired items in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7548
diff
changeset
|
1664 # test that there are no headers |
|
73dfa9df9fb0
issue685275 - show retired/unretired items in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7548
diff
changeset
|
1665 self.admin=AdminTool() |
|
73dfa9df9fb0
issue685275 - show retired/unretired items in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7548
diff
changeset
|
1666 with captured_output() as (out, err): |
|
73dfa9df9fb0
issue685275 - show retired/unretired items in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7548
diff
changeset
|
1667 sys.argv=['main', '-i', self.dirname, 'display', 'user3,user4'] |
|
73dfa9df9fb0
issue685275 - show retired/unretired items in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7548
diff
changeset
|
1668 ret = self.admin.main() |
|
73dfa9df9fb0
issue685275 - show retired/unretired items in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7548
diff
changeset
|
1669 out = out.getvalue().strip() |
|
73dfa9df9fb0
issue685275 - show retired/unretired items in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7548
diff
changeset
|
1670 print(out) |
|
73dfa9df9fb0
issue685275 - show retired/unretired items in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7548
diff
changeset
|
1671 self.assertNotIn("user3", out) |
|
73dfa9df9fb0
issue685275 - show retired/unretired items in roundup-admin
John Rouillard <rouilj@ieee.org>
parents:
7548
diff
changeset
|
1672 self.assertNotIn("user4", out) |
|
6430
ff4ab763f47c
issue2551141 - roundup-admin returns no such class when restoring item with duplicate key
John Rouillard <rouilj@ieee.org>
parents:
6393
diff
changeset
|
1673 |
| 6199 | 1674 def testTable(self): |
| 1675 ''' Note the tests will fail if you run this under pdb. | |
| 1676 the context managers capture the pdb prompts and this screws | |
| 1677 up the stdout strings with (pdb) prefixed to the line. | |
| 1678 ''' | |
| 1679 self.install_init() | |
| 1680 self.admin=AdminTool() | |
| 1681 | |
| 1682 with captured_output() as (out, err): | |
| 1683 sys.argv=['main', '-i', self.dirname, 'table' ] | |
| 1684 ret = self.admin.main() | |
| 1685 | |
| 1686 expected = 'Error: Not enough arguments supplied' | |
| 1687 | |
| 1688 out = out.getvalue().strip() | |
| 1689 print(out) | |
| 1690 print(expected) | |
| 1691 self.assertTrue(expected in out) | |
| 1692 #### | |
| 1693 | |
| 1694 self.admin=AdminTool() | |
| 1695 | |
| 1696 with captured_output() as (out, err): | |
| 1697 sys.argv=['main', '-i', self.dirname, 'table', | |
| 1698 'id,realname,username' ] | |
| 1699 ret = self.admin.main() | |
| 1700 | |
| 1701 expected = 'Error: no such class "id,realname,username"' | |
| 1702 | |
| 1703 out = out.getvalue().strip() | |
| 1704 print(out) | |
| 1705 print(expected) | |
| 1706 self.assertTrue(expected in out) | |
| 1707 | |
| 1708 #### | |
| 1709 self.admin=AdminTool() | |
| 1710 | |
| 1711 with captured_output() as (out, err): | |
| 1712 sys.argv=['main', '-i', self.dirname, 'table', 'user', | |
| 1713 'id,realname,username:4:3' ] | |
| 1714 ret = self.admin.main() | |
| 1715 expected = 'Error: "username:4:3" not name:width' | |
| 1716 | |
| 1717 out = out.getvalue().strip() | |
| 1718 print(out) | |
| 1719 print(expected) | |
| 1720 self.assertTrue(expected in out) | |
| 1721 | |
| 1722 #### | |
| 1723 self.admin=AdminTool() | |
| 1724 | |
| 1725 with captured_output() as (out, err): | |
| 1726 sys.argv=['main', '-i', self.dirname, 'table', 'user', | |
| 1727 'id,realname,title:4' ] | |
| 1728 ret = self.admin.main() | |
| 1729 expected = 'Error: user has no property "title"' | |
| 1730 | |
| 1731 out = out.getvalue().strip() | |
| 1732 print(out) | |
| 1733 print(expected) | |
| 1734 self.assertTrue(expected in out) | |
| 1735 | |
| 1736 #### | |
| 1737 self.admin=AdminTool() | |
| 1738 | |
| 1739 with captured_output() as (out, err): | |
| 1740 sys.argv=['main', '-i', self.dirname, 'table', 'user', | |
| 1741 'id,realname,username:' ] | |
| 1742 ret = self.admin.main() | |
| 1743 | |
| 1744 # note whitespace matters. trailing spaces on lines 1 and 2 | |
| 1745 expected = """Id Realname Username | |
| 1746 1 None admin | |
| 1747 2 None anonymou""" | |
| 1748 | |
| 1749 out = out.getvalue().strip() | |
| 1750 print(out) | |
| 1751 print(expected) | |
| 1752 self.assertEqual(out, expected) | |
| 1753 | |
| 1754 #### | |
| 1755 self.admin=AdminTool() | |
| 1756 | |
| 1757 with captured_output() as (out, err): | |
| 1758 sys.argv=['main', '-i', self.dirname, 'table', 'user', | |
| 1759 'id,realname,username' ] | |
| 1760 ret = self.admin.main() | |
| 1761 | |
| 1762 # note whitespace matters. trailing spaces on lines 1 and 2 | |
| 1763 expected = """Id Realname Username | |
| 1764 1 None admin | |
| 1765 2 None anonymous""" | |
| 1766 | |
| 1767 out = out.getvalue().strip() | |
| 1768 print(out) | |
| 1769 print(expected) | |
| 1770 self.assertEqual(out, expected) | |
| 1771 | |
| 1772 #### | |
| 1773 self.admin=AdminTool() | |
| 1774 | |
| 1775 with captured_output() as (out, err): | |
| 1776 sys.argv=['main', '-i', self.dirname, 'table', 'user', | |
| 1777 'id:4,realname:2,username:3' ] | |
| 1778 ret = self.admin.main() | |
| 1779 | |
| 1780 # note whitespace matters. trailing spaces on lines 1 and 2 | |
| 1781 expected = """Id Realname Username | |
| 1782 1 No adm | |
| 1783 2 No ano""" | |
| 1784 | |
| 1785 out = out.getvalue().strip() | |
| 1786 print(out) | |
| 1787 print(expected) | |
| 1788 self.assertEqual(out, expected) | |
| 1789 | |
|
6957
f924af12ef50
issue2551233 - create new roundup-admin command "templates"
John Rouillard <rouilj@ieee.org>
parents:
6430
diff
changeset
|
1790 def testTemplates(self): |
|
f924af12ef50
issue2551233 - create new roundup-admin command "templates"
John Rouillard <rouilj@ieee.org>
parents:
6430
diff
changeset
|
1791 |
|
f924af12ef50
issue2551233 - create new roundup-admin command "templates"
John Rouillard <rouilj@ieee.org>
parents:
6430
diff
changeset
|
1792 self.install_init() |
|
f924af12ef50
issue2551233 - create new roundup-admin command "templates"
John Rouillard <rouilj@ieee.org>
parents:
6430
diff
changeset
|
1793 self.admin=AdminTool() |
|
f924af12ef50
issue2551233 - create new roundup-admin command "templates"
John Rouillard <rouilj@ieee.org>
parents:
6430
diff
changeset
|
1794 |
|
f924af12ef50
issue2551233 - create new roundup-admin command "templates"
John Rouillard <rouilj@ieee.org>
parents:
6430
diff
changeset
|
1795 with captured_output() as (out, err): |
|
6958
e54a2db40a9e
check trackers trace_search as well.
John Rouillard <rouilj@ieee.org>
parents:
6957
diff
changeset
|
1796 # command does not require a tracker home. use missing zZzZ |
|
e54a2db40a9e
check trackers trace_search as well.
John Rouillard <rouilj@ieee.org>
parents:
6957
diff
changeset
|
1797 # directory to cause error if that changes |
|
6957
f924af12ef50
issue2551233 - create new roundup-admin command "templates"
John Rouillard <rouilj@ieee.org>
parents:
6430
diff
changeset
|
1798 sys.argv=['main', '-i', "zZzZ", 'templates' ] |
|
f924af12ef50
issue2551233 - create new roundup-admin command "templates"
John Rouillard <rouilj@ieee.org>
parents:
6430
diff
changeset
|
1799 ret = self.admin.main() |
|
f924af12ef50
issue2551233 - create new roundup-admin command "templates"
John Rouillard <rouilj@ieee.org>
parents:
6430
diff
changeset
|
1800 |
|
f924af12ef50
issue2551233 - create new roundup-admin command "templates"
John Rouillard <rouilj@ieee.org>
parents:
6430
diff
changeset
|
1801 out = out.getvalue().strip() |
|
f924af12ef50
issue2551233 - create new roundup-admin command "templates"
John Rouillard <rouilj@ieee.org>
parents:
6430
diff
changeset
|
1802 |
|
6958
e54a2db40a9e
check trackers trace_search as well.
John Rouillard <rouilj@ieee.org>
parents:
6957
diff
changeset
|
1803 # all 5 standard trackers should be found |
|
6957
f924af12ef50
issue2551233 - create new roundup-admin command "templates"
John Rouillard <rouilj@ieee.org>
parents:
6430
diff
changeset
|
1804 for tracker in ['Name: classic\nPath:', |
|
f924af12ef50
issue2551233 - create new roundup-admin command "templates"
John Rouillard <rouilj@ieee.org>
parents:
6430
diff
changeset
|
1805 'Name: devel\nPath:', |
|
f924af12ef50
issue2551233 - create new roundup-admin command "templates"
John Rouillard <rouilj@ieee.org>
parents:
6430
diff
changeset
|
1806 'Name: jinja2\nPath:', |
|
f924af12ef50
issue2551233 - create new roundup-admin command "templates"
John Rouillard <rouilj@ieee.org>
parents:
6430
diff
changeset
|
1807 'Name: minimal\nPath:', |
|
f924af12ef50
issue2551233 - create new roundup-admin command "templates"
John Rouillard <rouilj@ieee.org>
parents:
6430
diff
changeset
|
1808 'Name: responsive\nPath:']: |
|
f924af12ef50
issue2551233 - create new roundup-admin command "templates"
John Rouillard <rouilj@ieee.org>
parents:
6430
diff
changeset
|
1809 self.assertIn(tracker, out) |
|
5713
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
1810 |
|
6958
e54a2db40a9e
check trackers trace_search as well.
John Rouillard <rouilj@ieee.org>
parents:
6957
diff
changeset
|
1811 with captured_output() as (out, err): |
|
e54a2db40a9e
check trackers trace_search as well.
John Rouillard <rouilj@ieee.org>
parents:
6957
diff
changeset
|
1812 # command does not require a tracker home. use missing zZzZ |
|
e54a2db40a9e
check trackers trace_search as well.
John Rouillard <rouilj@ieee.org>
parents:
6957
diff
changeset
|
1813 # directory to cause error if that changes |
|
e54a2db40a9e
check trackers trace_search as well.
John Rouillard <rouilj@ieee.org>
parents:
6957
diff
changeset
|
1814 sys.argv=['main', '-i', "zZzZ", 'templates', 'trace_search' ] |
|
e54a2db40a9e
check trackers trace_search as well.
John Rouillard <rouilj@ieee.org>
parents:
6957
diff
changeset
|
1815 ret = self.admin.main() |
|
e54a2db40a9e
check trackers trace_search as well.
John Rouillard <rouilj@ieee.org>
parents:
6957
diff
changeset
|
1816 |
|
e54a2db40a9e
check trackers trace_search as well.
John Rouillard <rouilj@ieee.org>
parents:
6957
diff
changeset
|
1817 out = out.getvalue().strip() |
|
e54a2db40a9e
check trackers trace_search as well.
John Rouillard <rouilj@ieee.org>
parents:
6957
diff
changeset
|
1818 |
|
e54a2db40a9e
check trackers trace_search as well.
John Rouillard <rouilj@ieee.org>
parents:
6957
diff
changeset
|
1819 expected = "/*\n" |
|
e54a2db40a9e
check trackers trace_search as well.
John Rouillard <rouilj@ieee.org>
parents:
6957
diff
changeset
|
1820 self.assertIn(expected, out) |
|
e54a2db40a9e
check trackers trace_search as well.
John Rouillard <rouilj@ieee.org>
parents:
6957
diff
changeset
|
1821 |
|
5713
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
1822 class anydbmAdminTest(AdminTest, unittest.TestCase): |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
1823 backend = 'anydbm' |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
1824 |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
1825 |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
1826 @skip_mysql |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
1827 class mysqlAdminTest(AdminTest, unittest.TestCase): |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
1828 backend = 'mysql' |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
1829 |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
1830 |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
1831 class sqliteAdminTest(AdminTest, unittest.TestCase): |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
1832 backend = 'sqlite' |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
1833 |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
1834 |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
1835 @skip_postgresql |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
1836 class postgresqlAdminTest(AdminTest, unittest.TestCase): |
|
95dfdbaf5aa6
A basic set of tests for admin.py. Triggered by
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
1837 backend = 'postgresql' |
