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