Mercurial > p > roundup > code
annotate test/test_postgresql.py @ 8408:e882a5d52ae5
refactor: move RateLimitExceeded to roundup.cgi.exceptions
RateLimitExceeded is an HTTP exception that raises code 429. Move it
to roundup.cgi.exceptions where all the other exceptions that result
in http status codes are located. Also make it inherit from
HTTPException since it is one.
Also add docstrings for all HTTP exceptions and order HTTPExceptions
by status code.
BREAKING CHANGE: if somebody is importing RateLimitExceeded they will
need to change their import. I consider it unlikely anybody is using
RateLimitExceeded. Detectors and extensions are unlikely to raise
RateLimitExceeded. So I am leaving it out of the upgrading doc. Just
doc in change log.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 10 Aug 2025 21:27:06 -0400 |
| parents | 673bb9cb41b4 |
| children |
| rev | line source |
|---|---|
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1 # |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2 # Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/) |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3 # This module is free software, and you may redistribute it and/or modify |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
4 # under the same terms as Python, so long as this copyright message and |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
5 # disclaimer are retained in their original form. |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
6 # |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
7 # IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
8 # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
9 # OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
10 # POSSIBILITY OF SUCH DAMAGE. |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
11 # |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
12 # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
17 |
|
7723
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
18 import os |
|
2075
b1704ba7be41
make mysql / postgresql work again. beginnings of otk/session store in rdbmses
Richard Jones <richard@users.sourceforge.net>
parents:
1920
diff
changeset
|
19 import unittest |
|
7723
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
20 import pytest |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
21 |
|
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
22 from roundup.hyperdb import DatabaseError |
|
5215
917e45d9ba08
test_postgress isn't properly skipping tests when database is not
John Rouillard <rouilj@ieee.org>
parents:
5118
diff
changeset
|
23 from roundup.backends import get_backend, have_backend |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
24 |
|
5388
d26921b851c3
Python 3 preparation: make relative imports explicit.
Joseph Myers <jsm@polyomino.org.uk>
parents:
5319
diff
changeset
|
25 from .db_test_base import DBTest, ROTest, config, SchemaTest, ClassicInitTest |
|
d26921b851c3
Python 3 preparation: make relative imports explicit.
Joseph Myers <jsm@polyomino.org.uk>
parents:
5319
diff
changeset
|
26 from .db_test_base import ConcurrentDBTest, HTMLItemTest, FilterCacheTest |
|
d26921b851c3
Python 3 preparation: make relative imports explicit.
Joseph Myers <jsm@polyomino.org.uk>
parents:
5319
diff
changeset
|
27 from .db_test_base import ClassicInitBase, setupTracker, SpecialActionTest |
|
5601
fcbeff272828
Integrate REST tests into db framework
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5388
diff
changeset
|
28 from .rest_common import TestCase as RestTestCase |
|
1906
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
29 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
30 if not have_backend('postgresql'): |
|
5109
43a1f7fe39f5
Improved work-around for pytest markers bug
John Kristensen <john@jerrykan.com>
parents:
5105
diff
changeset
|
31 # FIX: workaround for a bug in pytest.mark.skip(): |
|
43a1f7fe39f5
Improved work-around for pytest markers bug
John Kristensen <john@jerrykan.com>
parents:
5105
diff
changeset
|
32 # https://github.com/pytest-dev/pytest/issues/568 |
|
43a1f7fe39f5
Improved work-around for pytest markers bug
John Kristensen <john@jerrykan.com>
parents:
5105
diff
changeset
|
33 from .pytest_patcher import mark_class |
|
43a1f7fe39f5
Improved work-around for pytest markers bug
John Kristensen <john@jerrykan.com>
parents:
5105
diff
changeset
|
34 skip_postgresql = mark_class(pytest.mark.skip( |
|
43a1f7fe39f5
Improved work-around for pytest markers bug
John Kristensen <john@jerrykan.com>
parents:
5105
diff
changeset
|
35 reason='Skipping PostgreSQL tests: backend not available')) |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
36 else: |
|
5215
917e45d9ba08
test_postgress isn't properly skipping tests when database is not
John Rouillard <rouilj@ieee.org>
parents:
5118
diff
changeset
|
37 try: |
|
7841
673bb9cb41b4
test: fix ImportError if psycopg2 not installed
John Rouillard <rouilj@ieee.org>
parents:
7723
diff
changeset
|
38 from roundup.backends.back_postgresql import psycopg2, db_command,\ |
|
673bb9cb41b4
test: fix ImportError if psycopg2 not installed
John Rouillard <rouilj@ieee.org>
parents:
7723
diff
changeset
|
39 get_database_schema_names |
|
5215
917e45d9ba08
test_postgress isn't properly skipping tests when database is not
John Rouillard <rouilj@ieee.org>
parents:
5118
diff
changeset
|
40 db_command(config, 'select 1') |
|
917e45d9ba08
test_postgress isn't properly skipping tests when database is not
John Rouillard <rouilj@ieee.org>
parents:
5118
diff
changeset
|
41 skip_postgresql = lambda func, *args, **kwargs: func |
|
917e45d9ba08
test_postgress isn't properly skipping tests when database is not
John Rouillard <rouilj@ieee.org>
parents:
5118
diff
changeset
|
42 except( DatabaseError ) as msg: |
|
917e45d9ba08
test_postgress isn't properly skipping tests when database is not
John Rouillard <rouilj@ieee.org>
parents:
5118
diff
changeset
|
43 from .pytest_patcher import mark_class |
|
917e45d9ba08
test_postgress isn't properly skipping tests when database is not
John Rouillard <rouilj@ieee.org>
parents:
5118
diff
changeset
|
44 skip_postgresql = mark_class(pytest.mark.skip( |
|
917e45d9ba08
test_postgress isn't properly skipping tests when database is not
John Rouillard <rouilj@ieee.org>
parents:
5118
diff
changeset
|
45 reason='Skipping PostgreSQL tests: database not available')) |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
46 |
|
5215
917e45d9ba08
test_postgress isn't properly skipping tests when database is not
John Rouillard <rouilj@ieee.org>
parents:
5118
diff
changeset
|
47 @skip_postgresql |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
48 class postgresqlOpener: |
|
2856
adec352e2ce0
don't try to import all backends in backends.__init__ unless we *want* to
Richard Jones <richard@users.sourceforge.net>
parents:
2682
diff
changeset
|
49 if have_backend('postgresql'): |
|
adec352e2ce0
don't try to import all backends in backends.__init__ unless we *want* to
Richard Jones <richard@users.sourceforge.net>
parents:
2682
diff
changeset
|
50 module = get_backend('postgresql') |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
51 |
| 6622 | 52 def setup_class(cls): |
| 53 # nuke the db once for the class. Handles the case | |
| 54 # where an aborted test run (^C during setUp for example) | |
| 55 # leaves the database in an unusable, partly configured state. | |
| 56 try: | |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
57 cls.nuke_database() |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
58 except Exception as m: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
59 # ignore failure to nuke the database if it doesn't exist. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
60 # otherwise abort |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
61 if str(m.args[0]) == ( |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
62 'database "%s" does not exist' % config.RDBMS_NAME): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
63 pass |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
64 else: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
65 raise |
| 6622 | 66 |
|
1906
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
67 def setUp(self): |
|
2075
b1704ba7be41
make mysql / postgresql work again. beginnings of otk/session store in rdbmses
Richard Jones <richard@users.sourceforge.net>
parents:
1920
diff
changeset
|
68 pass |
|
1906
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
69 |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
70 def tearDown(self): |
|
1920
f9316d2cd5ba
Fixed retirement of items in rdbms imports [SF#841355]
Richard Jones <richard@users.sourceforge.net>
parents:
1906
diff
changeset
|
71 self.nuke_database() |
|
f9316d2cd5ba
Fixed retirement of items in rdbms imports [SF#841355]
Richard Jones <richard@users.sourceforge.net>
parents:
1906
diff
changeset
|
72 |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
73 @classmethod |
|
1920
f9316d2cd5ba
Fixed retirement of items in rdbms imports [SF#841355]
Richard Jones <richard@users.sourceforge.net>
parents:
1906
diff
changeset
|
74 def nuke_database(self): |
|
2075
b1704ba7be41
make mysql / postgresql work again. beginnings of otk/session store in rdbmses
Richard Jones <richard@users.sourceforge.net>
parents:
1920
diff
changeset
|
75 # clear out the database - easiest way is to nuke and re-create it |
|
2856
adec352e2ce0
don't try to import all backends in backends.__init__ unless we *want* to
Richard Jones <richard@users.sourceforge.net>
parents:
2682
diff
changeset
|
76 self.module.db_nuke(config) |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
77 |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
78 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
79 class postgresqlSchemaOpener: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
80 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
81 RDBMS_NAME="rounduptest_schema.rounduptest" |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
82 RDBMS_USER="rounduptest_schema" |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
83 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
84 if have_backend('postgresql'): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
85 module = get_backend('postgresql') |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
86 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
87 def setup_class(cls): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
88 # nuke the schema for the class. Handles the case |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
89 # where an aborted test run (^C during setUp for example) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
90 # leaves the database in an unusable, partly configured state. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
91 config.RDBMS_NAME=cls.RDBMS_NAME |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
92 config.RDBMS_USER=cls.RDBMS_USER |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
93 |
|
7723
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
94 database, schema = get_database_schema_names(config) |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
95 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
96 try: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
97 cls.nuke_database() |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
98 except Exception as m: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
99 # ignore failure to nuke the database if it doesn't exist. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
100 # otherwise abort |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
101 if str(m.args[0]) == ( |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
102 'schema "%s" does not exist' % schema): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
103 pass |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
104 else: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
105 raise |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
106 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
107 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
108 # make sure to override the rdbms settings. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
109 # before every test. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
110 config.RDBMS_NAME=self.RDBMS_NAME |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
111 config.RDBMS_USER=self.RDBMS_USER |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
112 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
113 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
114 self.nuke_database() |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
115 config.RDBMS_NAME="rounduptest" |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
116 config.RDBMS_USER="rounduptest" |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
117 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
118 @classmethod |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
119 def nuke_database(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
120 # clear out the database - easiest way is to nuke and re-create it |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
121 self.module.db_nuke(config) |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
122 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
123 @skip_postgresql |
|
7723
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
124 class postgresqlServiceOpener: |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
125 """Test finding db and schema using pg_service.conf file.""" |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
126 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
127 PG_SERVICE="test/pg_service.conf" # look at the shipped pg_service file. |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
128 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
129 # default use db; overridden in test for schema |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
130 RDBMS_SERVICE="roundup_test_db" |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
131 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
132 if have_backend('postgresql'): |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
133 module = get_backend('postgresql') |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
134 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
135 def setup_class(cls): |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
136 # nuke the schema for the class. Handles the case |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
137 # where an aborted test run (^C during setUp for example) |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
138 # leaves the database in an unusable, partly configured state. |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
139 config.RDBMS_NAME="" |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
140 config.RDBMS_USER="" |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
141 config.RDBMS_PASSWORD="" |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
142 config.RDBMS_SERVICE=cls.RDBMS_SERVICE |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
143 os.environ['PGSERVICEFILE'] = cls.PG_SERVICE |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
144 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
145 # this is bad. but short of creating a new opener it works. |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
146 if cls.RDBMS_SERVICE == "roundup_test_schema_bad": |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
147 return |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
148 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
149 database, schema = get_database_schema_names(config) |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
150 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
151 try: |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
152 cls.nuke_database() |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
153 except Exception as m: |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
154 # ignore failure to nuke the database if it doesn't exist. |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
155 if str(m.args[0]) == ( |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
156 'database "%s" does not exist' % database) \ |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
157 and not schema: |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
158 pass |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
159 # ignore failure to nuke the schema if it doesn't exist. |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
160 elif str(m.args[0]) == ( |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
161 'schema "%s" does not exist' % schema) and schema: |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
162 pass |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
163 else: |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
164 raise |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
165 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
166 def setUp(self): |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
167 # make sure to override the rdbms settings. |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
168 # before every test. |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
169 config.RDBMS_NAME="" |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
170 config.RDBMS_USER="" |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
171 config.RDBMS_PASSWORD="" |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
172 config.RDBMS_SERVICE=self.RDBMS_SERVICE |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
173 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
174 os.environ['PGSERVICEFILE'] = self.PG_SERVICE |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
175 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
176 def tearDown(self): |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
177 # this is bad. but short of creating a new opener it works. |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
178 if self.RDBMS_SERVICE != "roundup_test_schema_bad": |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
179 self.nuke_database() |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
180 config.RDBMS_NAME="rounduptest" |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
181 config.RDBMS_USER="rounduptest" |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
182 config.RDBMS_PASSWORD="rounduptest" |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
183 config.RDBMS_SERVICE="" |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
184 del(os.environ['PGSERVICEFILE']) |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
185 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
186 @classmethod |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
187 def nuke_database(self): |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
188 # clear out the database - easiest way is to nuke and re-create it |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
189 self.module.db_nuke(config) |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
190 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
191 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
192 @skip_postgresql |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
193 class postgresqlPrecreatedSchemaDbOpener: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
194 """Open the db where the user has only schema create rights. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
195 The test tries to nuke the db and should result in an exception. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
196 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
197 RDBMS_NAME should not have the .schema on it as we want to |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
198 operate on the db itself with db_nuke. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
199 """ |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
200 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
201 RDBMS_NAME="rounduptest_schema" |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
202 RDBMS_USER="rounduptest_schema" |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
203 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
204 if have_backend('postgresql'): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
205 module = get_backend('postgresql') |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
206 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
207 def setup_class(cls): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
208 # nuke the schema for the class. Handles the case |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
209 # where an aborted test run (^C during setUp for example) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
210 # leaves the database in an unusable, partly configured state. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
211 config.RDBMS_NAME=cls.RDBMS_NAME |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
212 config.RDBMS_USER=cls.RDBMS_USER |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
213 |
|
1906
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
214 def setUp(self): |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
215 # make sure to override the rdbms settings. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
216 # before every test. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
217 config.RDBMS_NAME=self.RDBMS_NAME |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
218 config.RDBMS_USER=self.RDBMS_USER |
|
1906
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
219 |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
220 def tearDown(self): |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
221 config.RDBMS_NAME="rounduptest" |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
222 config.RDBMS_USER="rounduptest" |
|
1906
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
223 |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
224 @classmethod |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
225 def nuke_database(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
226 # clear out the database - easiest way is to nuke and re-create it |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
227 self.module.db_nuke(config) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
228 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
229 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
230 class postgresqlAdditionalDBTest(): |
|
6599
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
231 def testUpgrade_6_to_7(self): |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
232 |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
233 # load the database |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
234 self.db.issue.create(title="flebble frooz") |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
235 self.db.commit() |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
236 |
|
6806
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
237 if self.db.database_schema['version'] > 7: |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
238 # make testUpgrades run the downgrade code only. |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
239 if hasattr(self, "downgrade_only"): |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
240 # we are being called by an earlier test |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
241 self.testUpgrade_7_to_8() |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
242 self.assertEqual(self.db.database_schema['version'], 7) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
243 else: |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
244 # we are being called directly |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
245 self.downgrade_only = True |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
246 self.testUpgrade_7_to_8() |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
247 self.assertEqual(self.db.database_schema['version'], 7) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
248 del(self.downgrade_only) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
249 elif self.db.database_schema['version'] != 7: |
|
6599
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
250 self.skipTest("This test only runs for database version 7") |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
251 |
|
6604
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
252 # remove __fts table/index; shrink length of __words._words |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
253 # trying to insert a long word in __words._words should fail. |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
254 # trying to select from __fts should fail |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
255 # looking for the index should fail |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
256 # run post-init |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
257 # tests should succeed. |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
258 |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
259 self.db.sql("drop table __fts") # also drops __fts_idx |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
260 self.db.sql("alter table __words ALTER column _word type varchar(10)") |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
261 self.db.commit() |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
262 |
|
6599
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
263 self.db.database_schema['version'] = 6 |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
264 |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
265 long_string = "a" * (self.db.indexer.maxlength + 5) |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
266 with self.assertRaises(psycopg2.DataError) as ctx: |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
267 # DataError : value too long for type character varying(10) |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
268 self.db.sql("insert into __words VALUES('%s',1)" % long_string) |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
269 |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
270 self.assertIn("varying(10)", ctx.exception.args[0]) |
|
6604
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
271 self.db.rollback() # clear cursor error so db.sql can be used again |
|
6599
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
272 |
|
6604
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
273 with self.assertRaises(psycopg2.errors.UndefinedTable) as ctx: |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
274 self.db.sql("select * from _fts") |
|
6599
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
275 self.db.rollback() |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
276 |
|
6605
3f13ddd98e5c
Replace does_index_exist with db.sql_index_exists.
John Rouillard <rouilj@ieee.org>
parents:
6604
diff
changeset
|
277 self.assertFalse(self.db.sql_index_exists('__fts', '__fts_idx')) |
|
6604
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
278 |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
279 if hasattr(self, "downgrade_only"): |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
280 return |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
281 |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
282 # test upgrade path |
|
6599
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
283 self.db.post_init() |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
284 |
|
7206
521d98231e5c
Test self.db.db_version_updated in schema upgrade paths
John Rouillard <rouilj@ieee.org>
parents:
6915
diff
changeset
|
285 self.assertEqual(self.db.db_version_updated, True) |
|
521d98231e5c
Test self.db.db_version_updated in schema upgrade paths
John Rouillard <rouilj@ieee.org>
parents:
6915
diff
changeset
|
286 |
|
6599
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
287 # This insert with text of expected column size should succeed |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
288 self.db.sql("insert into __words VALUES('%s',1)" % long_string) |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
289 |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
290 # verify it fails at one more than the expected column size |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
291 too_long_string = "a" * (self.db.indexer.maxlength + 6) |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
292 with self.assertRaises(psycopg2.DataError) as ctx: |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
293 self.db.sql("insert into __words VALUES('%s',1)" % too_long_string) |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
294 |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
295 # clean db handle |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
296 self.db.rollback() |
|
39189dd94f2c
issue2551189 - increase size of words in full text index.
John Rouillard <rouilj@ieee.org>
parents:
5751
diff
changeset
|
297 |
|
6605
3f13ddd98e5c
Replace does_index_exist with db.sql_index_exists.
John Rouillard <rouilj@ieee.org>
parents:
6604
diff
changeset
|
298 self.assertTrue(self.db.sql_index_exists('__fts', '__fts_idx')) |
|
6604
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
299 |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
300 self.db.sql("select * from __fts") |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
301 |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
302 self.assertEqual(self.db.database_schema['version'], |
|
0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
John Rouillard <rouilj@ieee.org>
parents:
6599
diff
changeset
|
303 self.db.current_db_version) |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
304 |
|
6806
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
305 def testUpgrade_7_to_8(self): |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
306 """ change _time fields in BasicDatabases to double """ |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
307 # load the database |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
308 self.db.issue.create(title="flebble frooz") |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
309 self.db.commit() |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
310 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
311 if self.db.database_schema['version'] != 8: |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
312 self.skipTest("This test only runs for database version 8") |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
313 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
314 # change otk and session db's _time value to their original types |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
315 sql = "alter table sessions alter column session_time type REAL;" |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
316 self.db.sql(sql) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
317 sql = "alter table otks alter column otk_time type REAL;" |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
318 self.db.sql(sql) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
319 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
320 # verify they truncate long ints. |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
321 test_double = 1658718284.7616878 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
322 for tablename in ['otk', 'session']: |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
323 self.db.sql( |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
324 'insert into %(name)ss(%(name)s_key, %(name)s_time, %(name)s_value) ' |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
325 "values ('foo', %(double)s, 'value');"%{'name': tablename, |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
326 'double': test_double} |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
327 ) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
328 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
329 self.db.cursor.execute('select %(name)s_time from %(name)ss ' |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
330 "where %(name)s_key = 'foo'"%{'name': tablename}) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
331 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
332 self.assertNotAlmostEqual(self.db.cursor.fetchone()[0], |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
333 test_double, -1) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
334 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
335 # cleanup or else the inserts after the upgrade will not |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
336 # work. |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
337 self.db.sql("delete from %(name)ss where %(name)s_key='foo'"%{ |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
338 'name': tablename} ) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
339 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
340 self.db.database_schema['version'] = 7 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
341 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
342 if hasattr(self,"downgrade_only"): |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
343 return |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
344 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
345 # test upgrade altering row |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
346 self.db.post_init() |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
347 |
|
7206
521d98231e5c
Test self.db.db_version_updated in schema upgrade paths
John Rouillard <rouilj@ieee.org>
parents:
6915
diff
changeset
|
348 self.assertEqual(self.db.db_version_updated, True) |
|
521d98231e5c
Test self.db.db_version_updated in schema upgrade paths
John Rouillard <rouilj@ieee.org>
parents:
6915
diff
changeset
|
349 |
|
6806
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
350 # verify they keep all signifcant digits before the decimal point |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
351 for tablename in ['otk', 'session']: |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
352 self.db.sql( |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
353 'insert into %(name)ss(%(name)s_key, %(name)s_time, %(name)s_value) ' |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
354 "values ('foo', %(double)s, 'value');"%{'name': tablename, |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
355 'double': test_double} |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
356 ) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
357 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
358 self.db.cursor.execute('select %(name)s_time from %(name)ss ' |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
359 "where %(name)s_key = 'foo'"%{'name': tablename}) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
360 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
361 self.assertAlmostEqual(self.db.cursor.fetchone()[0], |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
362 test_double, -1) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
363 |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
364 self.assertEqual(self.db.database_schema['version'], 8) |
|
bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
John Rouillard <rouilj@ieee.org>
parents:
6805
diff
changeset
|
365 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
366 @skip_postgresql |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
367 class postgresqlDBTest(postgresqlOpener, DBTest, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
368 postgresqlAdditionalDBTest, unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
369 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
370 # set for manual integration testing of 'native-fts' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
371 # It is unset in tearDown so it doesn't leak into other tests. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
372 # FIXME extract test methods in DBTest that hit the indexer |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
373 # into a new class (DBTestIndexer). Add DBTestIndexer |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
374 # to this class. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
375 # Then create a new class in this file: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
376 # postgresqlDBTestIndexerNative_FTS |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
377 # that imports from DBestIndexer to test native-fts. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
378 # config['INDEXER'] = 'native-fts' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
379 postgresqlOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
380 DBTest.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
381 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
382 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
383 # clean up config to prevent leak if native-fts is tested |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
384 config['INDEXER'] = '' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
385 DBTest.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
386 postgresqlOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
387 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
388 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
389 @pytest.mark.pg_schema |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
390 class postgresqlDBTestSchema(postgresqlSchemaOpener, DBTest, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
391 postgresqlAdditionalDBTest, unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
392 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
393 # set for manual integration testing of 'native-fts' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
394 # It is unset in tearDown so it doesn't leak into other tests. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
395 # FIXME extract test methods in DBTest that hit the indexer |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
396 # into a new class (DBTestIndexer). Add DBTestIndexer |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
397 # to this class. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
398 # Then create a new class in this file: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
399 # postgresqlDBTestIndexerNative_FTS |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
400 # that imports from DBestIndexer to test native-fts. |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
401 # config['INDEXER'] = 'native-fts' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
402 postgresqlSchemaOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
403 DBTest.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
404 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
405 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
406 # clean up config to prevent leak if native-fts is tested |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
407 config['INDEXER'] = '' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
408 DBTest.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
409 postgresqlSchemaOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
410 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
411 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
412 @skip_postgresql |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
413 class postgresqlROTest(postgresqlOpener, ROTest, unittest.TestCase): |
|
1906
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
414 def setUp(self): |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
415 postgresqlOpener.setUp(self) |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
416 ROTest.setUp(self) |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
417 |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
418 def tearDown(self): |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
419 ROTest.tearDown(self) |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
420 postgresqlOpener.tearDown(self) |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
421 |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
422 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
423 @pytest.mark.pg_schema |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
424 class postgresqlROTestSchema(postgresqlSchemaOpener, ROTest, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
425 unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
426 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
427 postgresqlSchemaOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
428 ROTest.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
429 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
430 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
431 ROTest.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
432 postgresqlSchemaOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
433 |
|
7723
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
434 @skip_postgresql |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
435 class postgresqlServiceTest(postgresqlServiceOpener, ROTest, |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
436 unittest.TestCase): |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
437 """Test using pg_service.conf using the db to make sure connection |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
438 happens properly. |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
439 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
440 Reuses ROTest because it's a short test. |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
441 """ |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
442 def setUp(self): |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
443 postgresqlServiceOpener.setUp(self) |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
444 ROTest.setUp(self) |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
445 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
446 def tearDown(self): |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
447 ROTest.tearDown(self) |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
448 postgresqlServiceOpener.tearDown(self) |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
449 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
450 @skip_postgresql |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
451 @pytest.mark.pg_schema |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
452 class postgresqlServiceSchema(postgresqlServiceOpener, ROTest, |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
453 unittest.TestCase): |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
454 """Test using pg_service.conf using a schema to make sure connection |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
455 happens properly. |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
456 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
457 Reuses ROTest because it's a short test. |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
458 """ |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
459 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
460 RDBMS_SERVICE="roundup_test_schema" |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
461 def setUp(self): |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
462 postgresqlServiceOpener.setUp(self) |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
463 ROTest.setUp(self) |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
464 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
465 def tearDown(self): |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
466 ROTest.tearDown(self) |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
467 postgresqlServiceOpener.tearDown(self) |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
468 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
469 @skip_postgresql |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
470 @pytest.mark.pg_schema |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
471 class postgresqlServiceSchemaBad(postgresqlServiceOpener, unittest.TestCase): |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
472 """Test using pg_service.conf with incorrectly defined schema. Check |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
473 error message. No need for database. |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
474 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
475 FIXME: postgresqlServiceOpener.{setUp,tearDown} are written to behave |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
476 differently if cls.RDBMS_SERVICE="roundup_test_schema_bad". |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
477 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
478 I wanted the test, but I couldn't figure out a different |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
479 way to do this without creating a new opener and I didn't |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
480 want to 8-). |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
481 """ |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
482 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
483 RDBMS_SERVICE="roundup_test_schema_bad" |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
484 def setUp(self): |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
485 postgresqlServiceOpener.setUp(self) |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
486 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
487 def tearDown(self): |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
488 postgresqlServiceOpener.tearDown(self) |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
489 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
490 def test_bad_Schema_in_pg_service(self): |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
491 with self.assertRaises(ValueError) as m: |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
492 get_database_schema_names(config) |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
493 |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
494 print(m.exception.args[0]) |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
495 self.assertEqual(m.exception.args[0], |
|
8147f6deac9f
fix(db): Make using pg_service work again.
John Rouillard <rouilj@ieee.org>
parents:
7719
diff
changeset
|
496 'Unable to get schema for service: "roundup_test_schema_bad" from options: "-c search_path="') |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
497 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
498 @skip_postgresql |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
499 class postgresqlConcurrencyTest(postgresqlOpener, ConcurrentDBTest, |
|
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
500 unittest.TestCase): |
|
4448
2784c239e6c8
clear the cache on commit for rdbms backends:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3685
diff
changeset
|
501 backend = 'postgresql' |
|
2784c239e6c8
clear the cache on commit for rdbms backends:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3685
diff
changeset
|
502 def setUp(self): |
|
2784c239e6c8
clear the cache on commit for rdbms backends:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3685
diff
changeset
|
503 postgresqlOpener.setUp(self) |
|
2784c239e6c8
clear the cache on commit for rdbms backends:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3685
diff
changeset
|
504 ConcurrentDBTest.setUp(self) |
|
2784c239e6c8
clear the cache on commit for rdbms backends:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3685
diff
changeset
|
505 |
|
2784c239e6c8
clear the cache on commit for rdbms backends:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3685
diff
changeset
|
506 def tearDown(self): |
|
2784c239e6c8
clear the cache on commit for rdbms backends:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3685
diff
changeset
|
507 ConcurrentDBTest.tearDown(self) |
|
2784c239e6c8
clear the cache on commit for rdbms backends:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3685
diff
changeset
|
508 postgresqlOpener.tearDown(self) |
|
2784c239e6c8
clear the cache on commit for rdbms backends:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3685
diff
changeset
|
509 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
510 @skip_postgresql |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
511 @pytest.mark.pg_schema |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
512 class postgresqlConcurrencyTestSchema(postgresqlSchemaOpener, ConcurrentDBTest, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
513 unittest.TestCase): |
|
4887
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
514 backend = 'postgresql' |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
515 def setUp(self): |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
516 postgresqlSchemaOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
517 ConcurrentDBTest.setUp(self) |
|
4887
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
518 |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
519 def tearDown(self): |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
520 ConcurrentDBTest.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
521 postgresqlSchemaOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
522 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
523 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
524 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
525 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
526 class postgresqlAdditionalJournalTest(): |
|
4887
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
527 |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
528 def _test_journal(self, expected_journal): |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
529 id = self.id |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
530 db1 = self.db1 = self.tracker.open('admin') |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
531 db2 = self.db2 = self.tracker.open('admin') |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
532 |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
533 t1 = db1.issue.get(id, 'title') |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
534 t2 = db2.issue.get(id, 'title') |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
535 |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
536 db1.issue.set (id, title='t1') |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
537 db1.commit() |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
538 db1.close() |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
539 |
|
5118
57452bc6d989
issue2550853 - better error handling and cleanup on some postgres
John Rouillard <rouilj@ieee.org>
parents:
5109
diff
changeset
|
540 # Test testConcurrentRepeatableRead is expected to raise |
|
57452bc6d989
issue2550853 - better error handling and cleanup on some postgres
John Rouillard <rouilj@ieee.org>
parents:
5109
diff
changeset
|
541 # an error when the db2.issue.set() call is executed. |
|
57452bc6d989
issue2550853 - better error handling and cleanup on some postgres
John Rouillard <rouilj@ieee.org>
parents:
5109
diff
changeset
|
542 try: |
|
57452bc6d989
issue2550853 - better error handling and cleanup on some postgres
John Rouillard <rouilj@ieee.org>
parents:
5109
diff
changeset
|
543 db2.issue.set (id, title='t2') |
|
57452bc6d989
issue2550853 - better error handling and cleanup on some postgres
John Rouillard <rouilj@ieee.org>
parents:
5109
diff
changeset
|
544 db2.commit() |
|
57452bc6d989
issue2550853 - better error handling and cleanup on some postgres
John Rouillard <rouilj@ieee.org>
parents:
5109
diff
changeset
|
545 finally: |
|
57452bc6d989
issue2550853 - better error handling and cleanup on some postgres
John Rouillard <rouilj@ieee.org>
parents:
5109
diff
changeset
|
546 # Make sure that the db2 connection is closed, even when |
|
57452bc6d989
issue2550853 - better error handling and cleanup on some postgres
John Rouillard <rouilj@ieee.org>
parents:
5109
diff
changeset
|
547 # an error is raised. |
|
57452bc6d989
issue2550853 - better error handling and cleanup on some postgres
John Rouillard <rouilj@ieee.org>
parents:
5109
diff
changeset
|
548 db2.close() |
|
4887
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
549 self.db = self.tracker.open('admin') |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
550 journal = self.db.getjournal('issue', id) |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
551 for n, line in enumerate(journal): |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
552 self.assertEqual(line[4], expected_journal[n]) |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
553 |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
554 def testConcurrentReadCommitted(self): |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
555 expected_journal = [ |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
556 {}, {'title': 'initial value'}, {'title': 'initial value'} |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
557 ] |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
558 self._test_journal(expected_journal) |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
559 |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
560 def testConcurrentRepeatableRead(self): |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
561 self.tracker.config.RDBMS_ISOLATION_LEVEL='repeatable read' |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
562 exc = self.module.TransactionRollbackError |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
563 self.assertRaises(exc, self._test_journal, []) |
|
05c857e5dbed
New rdbms configuration option 'isolation_level'
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4878
diff
changeset
|
564 |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
565 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
566 class postgresqlJournalTest(postgresqlOpener, ClassicInitBase, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
567 postgresqlAdditionalJournalTest, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
568 unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
569 backend = 'postgresql' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
570 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
571 postgresqlOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
572 ClassicInitBase.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
573 self.tracker = setupTracker(self.dirname, self.backend) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
574 db = self.tracker.open('admin') |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
575 self.id = db.issue.create(title='initial value') |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
576 db.commit() |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
577 db.close() |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
578 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
579 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
580 try: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
581 self.db1.close() |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
582 self.db2.close() |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
583 except psycopg2.InterfaceError as exc: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
584 if 'connection already closed' in str(exc): pass |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
585 else: raise |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
586 ClassicInitBase.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
587 postgresqlOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
588 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
589 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
590 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
591 @pytest.mark.pg_schema |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
592 class postgresqlJournalTestSchema(postgresqlSchemaOpener, ClassicInitBase, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
593 postgresqlAdditionalJournalTest, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
594 unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
595 backend = 'postgresql' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
596 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
597 postgresqlSchemaOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
598 ClassicInitBase.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
599 self.tracker = setupTracker(self.dirname, self.backend) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
600 db = self.tracker.open('admin') |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
601 self.id = db.issue.create(title='initial value') |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
602 db.commit() |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
603 db.close() |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
604 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
605 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
606 try: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
607 self.db1.close() |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
608 self.db2.close() |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
609 except psycopg2.InterfaceError as exc: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
610 if 'connection already closed' in str(exc): pass |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
611 else: raise |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
612 ClassicInitBase.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
613 postgresqlSchemaOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
614 |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
615 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
616 @skip_postgresql |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
617 class postgresqlHTMLItemTest(postgresqlOpener, HTMLItemTest, |
|
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
618 unittest.TestCase): |
|
4878
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
619 backend = 'postgresql' |
|
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
620 def setUp(self): |
|
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
621 postgresqlOpener.setUp(self) |
|
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
622 HTMLItemTest.setUp(self) |
|
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
623 |
|
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
624 def tearDown(self): |
|
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
625 HTMLItemTest.tearDown(self) |
|
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
626 postgresqlOpener.tearDown(self) |
|
f6e76a03b502
HTML* classes for cgi are now all new-style
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
627 |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
628 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
629 @skip_postgresql |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
630 @pytest.mark.pg_schema |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
631 class postgresqlHTMLItemTestSchema(postgresqlSchemaOpener, HTMLItemTest, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
632 unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
633 backend = 'postgresql' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
634 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
635 postgresqlSchemaOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
636 HTMLItemTest.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
637 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
638 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
639 HTMLItemTest.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
640 postgresqlSchemaOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
641 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
642 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
643 @skip_postgresql |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
644 class postgresqlFilterCacheTest(postgresqlOpener, FilterCacheTest, |
|
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
645 unittest.TestCase): |
|
4472
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
646 backend = 'postgresql' |
|
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
647 def setUp(self): |
|
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
648 postgresqlOpener.setUp(self) |
|
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
649 FilterCacheTest.setUp(self) |
|
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
650 |
|
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
651 def tearDown(self): |
|
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
652 FilterCacheTest.tearDown(self) |
|
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
653 postgresqlOpener.tearDown(self) |
|
34dce76bb202
Multilink fixes and optimizations:
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
4448
diff
changeset
|
654 |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
655 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
656 @pytest.mark.pg_schema |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
657 class postgresqlFilterCacheTestSchema(postgresqlSchemaOpener, FilterCacheTest, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
658 unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
659 backend = 'postgresql' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
660 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
661 postgresqlSchemaOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
662 FilterCacheTest.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
663 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
664 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
665 FilterCacheTest.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
666 postgresqlSchemaOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
667 |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
668 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
669 @skip_postgresql |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
670 class postgresqlSchemaTest(postgresqlOpener, SchemaTest, unittest.TestCase): |
|
1906
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
671 def setUp(self): |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
672 postgresqlOpener.setUp(self) |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
673 SchemaTest.setUp(self) |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
674 |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
675 def tearDown(self): |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
676 SchemaTest.tearDown(self) |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
677 postgresqlOpener.tearDown(self) |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
678 |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
679 |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
680 @skip_postgresql |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
681 @pytest.mark.pg_schema |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
682 class postgresqlSchemaTestSchema(postgresqlSchemaOpener, SchemaTest, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
683 unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
684 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
685 postgresqlSchemaOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
686 SchemaTest.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
687 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
688 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
689 SchemaTest.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
690 postgresqlSchemaOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
691 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
692 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
693 @skip_postgresql |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
694 class postgresqlClassicInitTest(postgresqlOpener, ClassicInitTest, |
|
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
695 unittest.TestCase): |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
696 backend = 'postgresql' |
|
1906
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
697 def setUp(self): |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
698 postgresqlOpener.setUp(self) |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
699 ClassicInitTest.setUp(self) |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
700 |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
701 def tearDown(self): |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
702 ClassicInitTest.tearDown(self) |
|
f255363e6d97
PostgreSQL backend lands.
Richard Jones <richard@users.sourceforge.net>
parents:
1877
diff
changeset
|
703 postgresqlOpener.tearDown(self) |
|
1873
f63aa57386b0
Backend improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
704 |
|
5033
63c79c0992ae
Update tests to work with py.test
John Kristensen <john@jerrykan.com>
parents:
4887
diff
changeset
|
705 |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
706 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
707 @pytest.mark.pg_schema |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
708 class postgresqlClassicInitTestSchema(postgresqlSchemaOpener, ClassicInitTest, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
709 unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
710 backend = 'postgresql' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
711 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
712 postgresqlSchemaOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
713 ClassicInitTest.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
714 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
715 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
716 ClassicInitTest.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
717 postgresqlSchemaOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
718 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
719 |
|
5388
d26921b851c3
Python 3 preparation: make relative imports explicit.
Joseph Myers <jsm@polyomino.org.uk>
parents:
5319
diff
changeset
|
720 from .session_common import SessionTest |
|
5036
380d8d8b30a3
Replace existing run_tests.py script with a pytest script
John Kristensen <john@jerrykan.com>
parents:
5033
diff
changeset
|
721 @skip_postgresql |
|
5319
62de601bdf6f
Fix commits although a Reject exception is raised
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5310
diff
changeset
|
722 class postgresqlSessionTest(postgresqlOpener, SessionTest, unittest.TestCase): |
|
6805
09d9c646ca89
Put in missing s2b needed for session list test.
John Rouillard <rouilj@ieee.org>
parents:
6622
diff
changeset
|
723 s2b = lambda x,y : y |
|
09d9c646ca89
Put in missing s2b needed for session list test.
John Rouillard <rouilj@ieee.org>
parents:
6622
diff
changeset
|
724 |
|
2082
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
2075
diff
changeset
|
725 def setUp(self): |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
2075
diff
changeset
|
726 postgresqlOpener.setUp(self) |
|
5319
62de601bdf6f
Fix commits although a Reject exception is raised
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5310
diff
changeset
|
727 SessionTest.setUp(self) |
|
2082
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
2075
diff
changeset
|
728 def tearDown(self): |
|
5319
62de601bdf6f
Fix commits although a Reject exception is raised
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5310
diff
changeset
|
729 SessionTest.tearDown(self) |
|
2082
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
2075
diff
changeset
|
730 postgresqlOpener.tearDown(self) |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
2075
diff
changeset
|
731 |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
732 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
733 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
734 @pytest.mark.pg_schema |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
735 class postgresqlSessionTestSchema(postgresqlSchemaOpener, SessionTest, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
736 unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
737 s2b = lambda x,y : y |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
738 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
739 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
740 postgresqlSchemaOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
741 SessionTest.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
742 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
743 SessionTest.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
744 postgresqlSchemaOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
745 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
746 |
|
5310
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5248
diff
changeset
|
747 @skip_postgresql |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5248
diff
changeset
|
748 class postgresqlSpecialActionTestCase(postgresqlOpener, SpecialActionTest, |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5248
diff
changeset
|
749 unittest.TestCase): |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5248
diff
changeset
|
750 backend = 'postgresql' |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5248
diff
changeset
|
751 def setUp(self): |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5248
diff
changeset
|
752 postgresqlOpener.setUp(self) |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5248
diff
changeset
|
753 SpecialActionTest.setUp(self) |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5248
diff
changeset
|
754 |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5248
diff
changeset
|
755 def tearDown(self): |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5248
diff
changeset
|
756 SpecialActionTest.tearDown(self) |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5248
diff
changeset
|
757 postgresqlOpener.tearDown(self) |
|
efb34cbdba7c
Add (currently failing) test for atomic actions
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5248
diff
changeset
|
758 |
|
5601
fcbeff272828
Integrate REST tests into db framework
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5388
diff
changeset
|
759 @skip_postgresql |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
760 @pytest.mark.pg_schema |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
761 class postgresqlSpecialActionTestCaseSchema(postgresqlSchemaOpener, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
762 SpecialActionTest, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
763 unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
764 backend = 'postgresql' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
765 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
766 postgresqlSchemaOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
767 SpecialActionTest.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
768 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
769 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
770 SpecialActionTest.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
771 postgresqlSchemaOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
772 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
773 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
774 class postgresqlRestTest (postgresqlOpener, RestTestCase, unittest.TestCase): |
|
5601
fcbeff272828
Integrate REST tests into db framework
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5388
diff
changeset
|
775 backend = 'postgresql' |
|
7719
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
776 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
777 postgresqlOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
778 RestTestCase.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
779 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
780 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
781 RestTestCase.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
782 postgresqlOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
783 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
784 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
785 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
786 @pytest.mark.pg_schema |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
787 class postgresqlRestTestSchema(postgresqlSchemaOpener, RestTestCase, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
788 unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
789 backend = 'postgresql' |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
790 def setUp(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
791 postgresqlSchemaOpener.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
792 RestTestCase.setUp(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
793 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
794 def tearDown(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
795 RestTestCase.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
796 postgresqlSchemaOpener.tearDown(self) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
797 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
798 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
799 @skip_postgresql |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
800 @pytest.mark.pg_schema |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
801 class postgresqlDbDropFailureTestSchema(postgresqlPrecreatedSchemaDbOpener, |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
802 unittest.TestCase): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
803 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
804 def test_drop(self): |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
805 """Verify that the schema test database can not be dropped.""" |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
806 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
807 with self.assertRaises(RuntimeError) as m: |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
808 self.module.db_nuke(config) |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
809 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
810 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
811 self.assertEqual(m.exception.args[0], |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
812 'must be owner of database rounduptest_schema') |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
813 |
|
3071db43bfb6
feat: issue2550852 - support using a specified PostgreSQL db schema
John Rouillard <rouilj@ieee.org>
parents:
7206
diff
changeset
|
814 |
|
5601
fcbeff272828
Integrate REST tests into db framework
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5388
diff
changeset
|
815 |
|
2682
93c58a68061b
rdbms settings are now common for all backends.
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2358
diff
changeset
|
816 # vim: set et sts=4 sw=4 : |
