http://hg.code.sf.net:8000/p/roundup/code/atom-log/tip/test/test_config.py Mercurial Repository: p/roundup/code: test/test_config.py history 2025-09-22T14:12:46-04:00 take2: merge multiple fix: python < 3.12 returns ParsingError not RuntimeError; print exception http://hg.code.sf.net:8000/p/roundup/code/#changeset-f7fadbac5856a10a4b6eeea2edb4e1b4a5e4fa26 John Rouillard rouilj@ieee.org 2025-09-22T14:12:46-04:00 2025-09-22T14:12:46-04:00
changeset f7fadbac5856
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description take2: merge multiple fix: python < 3.12 returns ParsingError not RuntimeError; print exception
files
merge multiple fix: python < 3.12 returns ParsingError not RuntimeError; print exception http://hg.code.sf.net:8000/p/roundup/code/#changeset-9f7e863fd1cdcf71e6a7c3b6d490db53169ae446 John Rouillard rouilj@ieee.org 2025-09-22T14:08:36-04:00 2025-09-22T14:08:36-04:00
changeset 9f7e863fd1cd
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description merge multiple fix: python < 3.12 returns ParsingError not RuntimeError; print exception
files
fix: python < 3.12 returns ParsingError not RuntimeError; print exception http://hg.code.sf.net:8000/p/roundup/code/#changeset-6d6f689d3701791b0666cb74cfdcc6ea4619101c John Rouillard rouilj@ieee.org 2025-09-22T13:57:52-04:00 2025-09-22T13:57:52-04:00
changeset 6d6f689d3701
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description fix: python < 3.12 returns ParsingError not RuntimeError; print exception

RuntimeError added in 3.12. Support older configparser.ParsingError.

Supporting older version also requires different test string for the
two versions.

Also use str(exception) rather than exception.args[0] for producing
message to user. Include exception name in output.
files
bug: improve error reporting for errors for logging fileConfig. http://hg.code.sf.net:8000/p/roundup/code/#changeset-e91ff70e456374163f56e435d671eff185fb7117 John Rouillard rouilj@ieee.org 2025-09-20T16:49:38-04:00 2025-09-20T16:49:38-04:00
changeset e91ff70e4563
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description bug: improve error reporting for errors for logging fileConfig.
files
bug: fix json logging config file syntax exception/fix test for windows http://hg.code.sf.net:8000/p/roundup/code/#changeset-401c6f0be6c516cc2fd8358519ef17749bd0a0e0 John Rouillard rouilj@ieee.org 2025-09-17T19:58:08-04:00 2025-09-17T19:58:08-04:00
changeset 401c6f0be6c5
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description bug: fix json logging config file syntax exception/fix test for windows

If the json logging config file has mimatched {} or [], it raises
an IndexError. Handle that case and test it.

Also handle embedded filenames in tests when testsare run on
windows:(/ vs \ directory sep).
files
bug, test: fix tests for trace_id; readd import logging.config http://hg.code.sf.net:8000/p/roundup/code/#changeset-d06be9346c68beb5115e0fe9fadc67311a10ccc7 John Rouillard rouilj@ieee.org 2025-09-17T00:45:04-04:00 2025-09-17T00:45:04-04:00
changeset d06be9346c68
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description bug, test: fix tests for trace_id; readd import logging.config

Made save_restore_logging a test level fixture. It was a class level
which worked fine until I started using caplog for tests in the same
class. Due to loading config from dict, the roundup channel was set to
not propagate which broke the new formatting test used for trace_id.

Forgot to update some tests due to change in default format adding
%(trace_id).

Also re-added logging.config import which broke loading logging config
files in configuration.py.
files
feature: add thread local trace_id and trace_reason to logging. http://hg.code.sf.net:8000/p/roundup/code/#changeset-14c7c07b32d846e405260147a3112e8c8b15642a John Rouillard rouilj@ieee.org 2025-09-16T22:53:00-04:00 2025-09-16T22:53:00-04:00
changeset 14c7c07b32d8
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description feature: add thread local trace_id and trace_reason to logging.

Added trace_id to default logging so that all logs for a given request
share the same trace_id.

This allows correlation of logs across a request.

admin_guide.txt, upgrading.txt:
add docs
update sample configs to include trace_id.
rewrite logging docs in admin_guide. Hopefully they are clearer now.
clean up some stuff in the logging config file docs.

admin.py:

add decorators to run_command to enable trace_id.
change calls to db.commit() to use run_command to get trace_id.

configuration.py:

clean up imports.
update docstrings, comments and inline docs.
add trace_id to default log format.
add function for testing decorated with trace_id.
add support for dumping stack trace in logging.
add check for pytest in sys.modules to enable log propagation when
pytest is running. Otherwise tests fail as the caplog logger doesn't
see the roundup logs.

logcontext.py:

new file to handle thread local contextvar mangement.

mailgw.py:

add decorators for trace_id etc.

scripts/roundup_xlmrpc_server.py:

add decorators for trace_id etc.
fix encoding bug turning bytes into a string.
fix command line issue where we can't set encoding. (not sure if
changing encoding via command line even works)

cgi/client.py

decorate two entry points for trace_id etc.

cgi/wsgi_handler.py:

decorate entry point for trace_id etc.

test/test_config.py:

add test for trace_id in new log format.
test various cases for sinfo and errors in formating msg.
files
feat: allow admin to set logging format from config.ini http://hg.code.sf.net:8000/p/roundup/code/#changeset-39a6825d10ca01b1291dc124cd848708932054ee John Rouillard rouilj@ieee.org 2025-09-01T21:54:48-04:00 2025-09-01T21:54:48-04:00
changeset 39a6825d10ca
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description feat: allow admin to set logging format from config.ini

This is prep work for adding a per thread logging variable that can be
used to tie all logs for a single request together.

This uses the same default logging format as before, just moves it to
config.ini.

Also because of configparser, the logging format has to have doubled %
signs. So use:

%%(asctime)s

not '%(asctime)s' as configparser tries to interpolate that string and
asctime is not defined in the configparser's scope. Using %%(asctime)s
is not interpolated by configparser and is passed into Roundup.
files
refactor: also error on missing file or invalid extension http://hg.code.sf.net:8000/p/roundup/code/#changeset-66284037142ea32cd76f62a914a510156a8b797c John Rouillard rouilj@ieee.org 2025-08-26T23:06:40-04:00 2025-08-26T23:06:40-04:00
changeset 66284037142e
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description refactor: also error on missing file or invalid extension

Refactored the code to reuse check that logging config file is set and
that the file exists.

Now throws error and exits if file name does not end in .ini or .json.

Now throws error if file doesn't exist. Before it would just configure
default logging as though file wasn't specified.

Added tests for these two cases.
files
feat: change comment in dictConfig json file to // from # http://hg.code.sf.net:8000/p/roundup/code/#changeset-de1dac9abcb64889eb06281fcf1474ae44cb7e96 John Rouillard rouilj@ieee.org 2025-08-26T22:24:00-04:00 2025-08-26T22:24:00-04:00
changeset de1dac9abcb6
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description feat: change comment in dictConfig json file to // from #

Emacs json mode at least will properly indent when using // as a
comment character and not #.
files
test: fix code that does not run a test on 3.7 http://hg.code.sf.net:8000/p/roundup/code/#changeset-3210729950b1788b243e41acdcbf88832f37a3eb John Rouillard rouilj@ieee.org 2025-08-21T09:53:32-04:00 2025-08-21T09:53:32-04:00
changeset 3210729950b1
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description test: fix code that does not run a test on 3.7
files
test: test dictLoggerConfig - working logging reset and windows http://hg.code.sf.net:8000/p/roundup/code/#changeset-cdf876bcd370641d0662c03eac2bb84d462a5534 John Rouillard rouilj@ieee.org 2025-08-20T21:04:56-04:00 2025-08-20T21:04:56-04:00
changeset cdf876bcd370
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description test: test dictLoggerConfig - working logging reset and windows

Finally figured out why things weren't being restored. Bug in the
code.

Created a class fixture that stores and restores the logging config.

Also using os.path.join and other machinations to make the tests run
under windows and linux correctly.
files
test: more fun with logger leakage. http://hg.code.sf.net:8000/p/roundup/code/#changeset-b34c3b8338f0122149b2945bc0a2bf73570104c3 John Rouillard rouilj@ieee.org 2025-08-20T16:13:52-04:00 2025-08-20T16:13:52-04:00
changeset b34c3b8338f0
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description test: more fun with logger leakage.

I have disabled all calls to dictConfig. I can't see how to stop this
from leaking.

I even tried storing the root and roundup logger state (copying lists)
before running anything and restoring afterwards.

the funny part is if I removae all dictConfig calls and keep the state
saving and logger reset and restoring code it sill fails.

It passes if I don't restore the handler state for the root logger.

However the test will fail even when I comment out the root logger
config in the dict if I apply the dict. ????
files
test: more fixes for variations among python versions. http://hg.code.sf.net:8000/p/roundup/code/#changeset-cd0edc091b97d41931e1e5f6e48fb9ec23da90a3 John Rouillard rouilj@ieee.org 2025-08-20T12:53:14-04:00 2025-08-20T12:53:14-04:00
changeset cd0edc091b97
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description test: more fixes for variations among python versions.

reset logging. The loggers I installed are bleeding through to tests
in other modules.

Then handle recogniton of:

trailing comma in json reporting line with comma not following line

incorrect type value in dictConfig int where string should be
3.7 fils to detect. 3.10+ add "got 'int'" to reason.
files
test: fix testDictLoggerConfigViaJson http://hg.code.sf.net:8000/p/roundup/code/#changeset-4a948ad465792926be224ae391c3da701bb50cc5 John Rouillard rouilj@ieee.org 2025-08-20T11:17:23-04:00 2025-08-20T11:17:23-04:00
changeset 4a948ad46579
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description test: fix testDictLoggerConfigViaJson

The path to the log file in the config did not exist. Change to use
the tracker home.


Also add a test where the log file directory does not exist. This
reports the full path, so have to edit the full path in the error
message before comparison.
files
feat: add support for using dictConfig to configure logging. http://hg.code.sf.net:8000/p/roundup/code/#changeset-94eed885e9582203be3a66fa5d0c0c122cbaaa84 John Rouillard rouilj@ieee.org 2025-08-19T22:32:46-04:00 2025-08-19T22:32:46-04:00
changeset 94eed885e958
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description feat: add support for using dictConfig to configure logging.

Basic logging config (one level and one output file non-rotating) was
always possible from config.ini. However the LOGGING_CONFIG setting
could be used to load an ini fileConfig style file to set various
channels (e.g. roundup.hyperdb) (also called qualname or tags) with
their own logging level, destination (rotating file, socket,
/dev/null) and log format.

This is now a deprecated method in newer logging modules. The
dictConfig format is preferred and allows disabiling other loggers as
well as invoking new loggers in local code. This commit adds support
for it reading the dict from a .json file. It also implements a
comment convention so you can document the dictConfig.

configuration.py:
new code

test_config.py:
test added for the new code.

admin_guide.txt, upgrading.txt CHANGES.txt:
docs added upgrading references the section in admin_guid.
files
test: clean up test for deprecation of xhtml. http://hg.code.sf.net:8000/p/roundup/code/#changeset-1e38ca6fb16e30f26bc23523dbe5365c9cbd209f John Rouillard rouilj@ieee.org 2024-05-14T22:35:56-04:00 2024-05-14T22:35:56-04:00
changeset 1e38ca6fb16e
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description test: clean up test for deprecation of xhtml.

xhtml was used as a value in a test. Choose different value for
testing.

Also add test to verify that xhtml use raises an error.
files
issue2551334 - get test suite running under windows http://hg.code.sf.net:8000/p/roundup/code/#changeset-6102ae4263903802439209ff24dfade2f0131b02 John Rouillard rouilj@ieee.org 2024-04-28T09:17:54-04:00 2024-04-28T09:17:54-04:00
changeset 6102ae426390
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description issue2551334 - get test suite running under windows

Support windows style filepaths.
files
test: skip test requiring postgresql backend if not present http://hg.code.sf.net:8000/p/roundup/code/#changeset-011941fcb598646295e281325ea9635e0dc6386a John Rouillard rouilj@ieee.org 2024-04-20T16:27:23-04:00 2024-04-20T16:27:23-04:00
changeset 011941fcb598
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description test: skip test requiring postgresql backend if not present
files
feat: add support for rotating jwt keys http://hg.code.sf.net:8000/p/roundup/code/#changeset-be6cb2e0d47124399ccfc3326690c7c2049713c6 John Rouillard rouilj@ieee.org 2024-03-14T19:04:19-04:00 2024-03-14T19:04:19-04:00
changeset be6cb2e0d471
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description feat: add support for rotating jwt keys

This allows jwt_secret to have multiple ',' separated secrets. The
first/leftmost should be used to sign new JWTs. All of them are used
(starting from left/newest) to try to verify a JWT.

If the first secret is < 32 chars in length JWTs are disabled. If any
of the other secrets are < 32 chars, the configuration code causes the
software to exit. This prevents insecure (too short) secrets from
being used.

Updated doc examples and tests.
files
test: fix mising / in directory spec. http://hg.code.sf.net:8000/p/roundup/code/#changeset-a5629f6e7ec2b413062bd6d019f1bb7ab7bc26d6 John Rouillard rouilj@ieee.org 2023-07-24T18:07:11-04:00 2023-07-24T18:07:11-04:00
changeset a5629f6e7ec2
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description test: fix mising / in directory spec.
files
fix(api): - issue2551063 - Rest/Xmlrpc interfaces needs failed login protection. http://hg.code.sf.net:8000/p/roundup/code/#changeset-273c8c2b504245a937efbd42604f77cb2d3d0d9d John Rouillard rouilj@ieee.org 2023-07-19T20:37:45-04:00 2023-07-19T20:37:45-04:00
changeset 273c8c2b5042
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description fix(api): - issue2551063 - Rest/Xmlrpc interfaces needs failed login protection.

Failed API login rate limiting with expiring lockout added.
files
improve REST interface security http://hg.code.sf.net:8000/p/roundup/code/#changeset-89a59e46b3af7bb327ebf079c34e22bbbff8bbf2 John Rouillard rouilj@ieee.org 2023-02-23T12:01:33-05:00 2023-02-23T12:01:33-05:00
changeset 89a59e46b3af
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description improve REST interface security

When using REST, we reflect the client's origin. If the wildcard '*'
is used in allowed_api_origins all origins are allowed. When this is
done, it also added an 'Access-Control-Allow-Credentials: true'
header.

This Credentials header should not be added if the site is matched
only by '*'. This header should be provided only for explicit origins
(e.g. https://example.org) not for the wildcard.

This is now fixed for CORS preflight OPTIONS request as well as normal
GET, PUT, DELETE, POST, PATCH and OPTIONS requests.

A missing Access-Control-Allow-Credentials will prevent the tracker
from being accessed using credentials. This prevents an unauthorized
third party web site from using a user's credentials to access
information in the tracker that is not publicly available.

Added test for this specific case.

In addition, allowed_api_origins can include explicit origins in
addition to '*'. '*' must be first in the list.

Also adapted numerous tests to work with these changes.

Doc updates.
files
Fix test if redis is not loaded http://hg.code.sf.net:8000/p/roundup/code/#changeset-e0f0aed7209763d66ad746a1a22500c83764535a John Rouillard rouilj@ieee.org 2022-08-07T00:45:06-04:00 2022-08-07T00:45:06-04:00
changeset e0f0aed72097
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description Fix test if redis is not loaded

handle the KeyError from trying to remove redis from sys.modules if it
not loaded.
files
Summary: Support selecion session/otk data store. Add redis as data store. http://hg.code.sf.net:8000/p/roundup/code/#changeset-3f60a71b081240cebcb1c0e96d760e7a9c790612 John Rouillard rouilj@ieee.org 2022-08-04T14:41:58-04:00 2022-08-04T14:41:58-04:00
changeset 3f60a71b0812
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description Summary: Support selecion session/otk data store. Add redis as data store.

Allow admin to select the backend data store. Compatibility matrix:

main\/ session>| anydbm | sqlite | redis | mysql | postgresql |
anydbm | D | | X | | |
sqlite | X | D | X | | |
mysql | | | | D | |
postgresql | | | | | D |
--------------------------------------------------------------+
D - default if unconfigured, X - compatible choice

DETAILS

roundup/configuration.py:
add config.ini section sessiondb with settings: backend and redis_url.

CHANGES.txt, doc/admin_guide.txt, doc/installation.txt, doc/upgrading.txt:
doc on config of session db and redis. Plus some other fixes:

admin - clarified why we do not drop __words and __testids
table in native-fts conversion. TYpo fix.

upgrading - doc how you can keep using anydbm for session data with
sqlite. Fix dupe sentence in an upgrading config.ini
section.

roundup/backends/back_anydbm.py, roundup/backends/back_sqlite.py:
code to support redis, redis/anydbm backends respectively.

roundup/backends/sessions_redis.py
new storage backend for redis.

roundup/rest.py, roundup/cgi/actions.py, roundup/cgi/templating.py
redis uses a different way of calculating lifetime/timestamp.
Since expiration of an item occurred if its timestamp was more
than 1 week old, code would calculate:
now - 1 week + lifetime.
But this results in faster expiration in redis if used for
lifetime/timestamp.
Convert code to use the lifetime() method in BasicDatabase
that generates the right timestamp for each backend.

test/session_common.py:
added tests for more cases, get without default, getall non-existing
key etc. timestamp test changed to use new self.get_ts which is
overridden in other tests. Test that datatypes survive storage.

test/test_redis_session.py:
test redis session store with sqlite and anydbm primary databases

test/test_anydbm.py, test/test_sqlite.py
add test to make sure the databases are properly set up

sqlite - add test cases where anydbm is used as datastore
anydbm - remove updateTimestamp override add get_ts().

test/test_config.py
tests on redis_url and compatibility on choice of sessiondb backend

.travis.yml:
add redis db and redis-py
files
issue2551205: Add support for specifying valid origins for api: xmlrpc/rest http://hg.code.sf.net:8000/p/roundup/code/#changeset-ab2ed11c021eec91ca1a624ee4ee259e2282741d John Rouillard rouilj@ieee.org 2022-05-17T17:18:51-04:00 2022-05-17T17:18:51-04:00
changeset ab2ed11c021e
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description issue2551205: Add support for specifying valid origins for api: xmlrpc/rest

We now have an allow list to filter the hosts allowed to do api
requests. An element of this allow list must match the http ORIGIN
header exactly or the rest/xmlrpc CORS request will result in an
error.

The tracker host is always allowed to do a request.
files
Allow Roundup to use PostgreSQL database native full text search http://hg.code.sf.net:8000/p/roundup/code/#changeset-0d99ae7c8de62fdc4561e7f0a8a6b38da86e34cd John Rouillard rouilj@ieee.org 2022-01-27T19:48:48-05:00 2022-01-27T19:48:48-05:00
changeset 0d99ae7c8de6
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description Allow Roundup to use PostgreSQL database native full text search

back_postgreql.py - schema version changes for schema version 7.

configuration.py - added indexer_language checks for postgresql. Hardcoded
list for now.

Docs admin_guide and upgrading

Tests.


This also restructures the version upgrade tests for the rdbms
backends. They can run all of them now as the proper cascade is
developed to roll back changes to version 6.
files
Validate SecretOption and support validate method http://hg.code.sf.net:8000/p/roundup/code/#changeset-770503bd211eaf1eb341da789b6d1b6050df28e5 John Rouillard rouilj@ieee.org 2022-01-06T21:22:26-05:00 2022-01-06T21:22:26-05:00
changeset 770503bd211e
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description Validate SecretOption and support validate method

Needed to validate SecretOption and verify that file is readable
and valid.

validator() now calls the validate method for each Option subclass.

To add post config load validation, just define a method
validate(self, options) for the Option subclass.
files
issue2551182 - ... allow loading values from external file. flake8 cleanups http://hg.code.sf.net:8000/p/roundup/code/#changeset-b1f1539c6a31d172e1b4366184069f0f96b36747 John Rouillard rouilj@ieee.org 2022-01-03T22:18:57-05:00 2022-01-03T22:18:57-05:00
changeset b1f1539c6a31
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description issue2551182 - ... allow loading values from external file. flake8 cleanups

Secrets (passwords, secrets) can specify a file using file:// or
file:///. The first line of the file is used as the secret. This
allows committing config.ini to a VCS.

Following settings are changed:

[tracker] secret_key
[tracker] jwt_secret
[rdbms] password
[mail] password

details:

in roundup/configuration.py:

Defined SecretMandatoryOptions and SecretNullableOptions. Converted
all secret keys and password to one of the above.

Also if [mail] username is defined but [mail] password is not it
throws an error at load.

Cleaned up a couple of methods whose call signature included:

def ...(..., settings={}):

settings=None and it is set to empty dict inside the method.

Also replace exception.message with str(exception) for python3
compatibility.

in test/test_config:

changed munge_configini to support changing only within a section,
replacing keyword text.
files
Add test for config parse error by running AdminTool. http://hg.code.sf.net:8000/p/roundup/code/#changeset-fdfe3b7387ea9b882abc124267c07779694e626f John Rouillard rouilj@ieee.org 2021-12-13T22:18:15-05:00 2021-12-13T22:18:15-05:00
changeset fdfe3b7387ea
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description Add test for config parse error by running AdminTool.
files
Handle configparser.InterpolationSyntaxError http://hg.code.sf.net:8000/p/roundup/code/#changeset-8687c096a94533b8c02c855e6dc9bdff07f8c7c5 John Rouillard rouilj@ieee.org 2021-12-13T12:48:57-05:00 2021-12-13T12:48:57-05:00
changeset 8687c096a945
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description Handle configparser.InterpolationSyntaxError

Under Python 3, an option value with a single % (e.g. this % is a
test) throws

configparser.InterpolationSyntaxError: '%' must be followed by
'%' or '(', found: '%s))'

Added code to capture this, raise a different exception. roundup-admin
handles the error and exits cleanly. Other code shows the traceback.

The new error message reports the file, section and option causing the
problem to allow easier repair.

Also updated roundup translations and added tests.
files
Fix failing xapian test http://hg.code.sf.net:8000/p/roundup/code/#changeset-5c1db5d4baed43d9e26336a074599b11a0556469 Ralf Schlatterbeck rsc@runtux.com 2021-04-01T08:58:51+02:00 2021-04-01T08:58:51+02:00
changeset 5c1db5d4baed
branch
bookmark
tag
user Ralf Schlatterbeck <rsc@runtux.com>
description Fix failing xapian test
files
issue2551125 Add indexer_lang test that runs if xapian not installed http://hg.code.sf.net:8000/p/roundup/code/#changeset-e3ed3ad9e79551c74fa7b07002ed9636911f6528 John Rouillard rouilj@ieee.org 2021-03-31T09:19:03-04:00 2021-03-31T09:19:03-04:00
changeset e3ed3ad9e795
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description issue2551125 Add indexer_lang test that runs if xapian not installed

Test case for xapian not installed. Same test as
testInvalidIndexerLanguage_xapian_missing except without magling
sys.modules.
files
issue2551125 Make indexer_lang test work if xapian not installed. http://hg.code.sf.net:8000/p/roundup/code/#changeset-8a7de159d1a657056fde5b568cef066e94c8ce85 John Rouillard rouilj@ieee.org 2021-03-31T08:43:03-04:00 2021-03-31T08:43:03-04:00
changeset 8a7de159d1a6
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description issue2551125 Make indexer_lang test work if xapian not installed.

Reported by Ralf in https://issues.roundup-tracker.org/issue2551125.
files
Use OptionValueError for indexer_language error, add configuration tests http://hg.code.sf.net:8000/p/roundup/code/#changeset-08e209a7f22b79c635569e037efea353061ab799 John Rouillard rouilj@ieee.org 2021-03-30T18:03:37-04:00 2021-03-30T18:03:37-04:00
changeset 08e209a7f22b
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description Use OptionValueError for indexer_language error, add configuration tests

Added more tests for configuration.py. This is the last of the easy to
do tests for the module.

While doing that figured out how to get the proper arguments to
generate OptionValueError if indexer_language is invalid. Changed
implementation to generate same and updated test.
files
Test trying to load missing config.ini file. http://hg.code.sf.net:8000/p/roundup/code/#changeset-2d42a308927b5e95c4728cbd5dc4f0af34868688 John Rouillard rouilj@ieee.org 2021-03-30T02:39:48-04:00 2021-03-30T02:39:48-04:00
changeset 2d42a308927b
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description Test trying to load missing config.ini file.

Noticed this case wasn't covered by tests. Low hanging fruit.
files
Validate indexer values http://hg.code.sf.net:8000/p/roundup/code/#changeset-42db48c30d319c6293457dc3980b6177587fa356 John Rouillard rouilj@ieee.org 2021-03-30T02:24:22-04:00 2021-03-30T02:24:22-04:00
changeset 42db48c30d31
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description Validate indexer values

Make sure that indexer values are one of the supported indexers.
Invalid values would have raised an invalid indexer exception on
access.
files
Add testcases for invalid indexer_language http://hg.code.sf.net:8000/p/roundup/code/#changeset-c985ed52ca2d87ed16165a2caf6962db3d810394 John Rouillard rouilj@ieee.org 2021-03-30T02:10:00-04:00 2021-03-30T02:10:00-04:00
changeset c985ed52ca2d
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description Add testcases for invalid indexer_language

Set invalid indexer_language and test:

indexer = "" and xapian not able to be loaded -> no exception

indexer = native -> no exception

indexer = xapian -> ValueError exception

Also test reset to verify that indexer_language is reset to english
from NO_LANG.

Also create helper method to munge config.ini for each test case.
Changed all test to use it.

Also moved doc from class to the test that it described.
files
issue2551123 - validate indexer_language in configuration.py http://hg.code.sf.net:8000/p/roundup/code/#changeset-c26b9ce33ae3962dab1cc0ea7fa6b19b87adef5a John Rouillard rouilj@ieee.org 2021-03-29T22:47:54-04:00 2021-03-29T22:47:54-04:00
changeset c26b9ce33ae3
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description issue2551123 - validate indexer_language in configuration.py

Was validated in backends/indexer_xapian.py which would throw
an error on access rather than on start.

Added validator function to CoreConfig class that runs after
config.ini is read. At this time we have access to the indexer setting
so can determine if xapian is actually going to be used.

Moved test into test/test_config.py and pulled validation code from
indexer_xapian.py and test/test_indexer.py.
files
Test case where backend is missing from config.ini. http://hg.code.sf.net:8000/p/roundup/code/#changeset-c547e05d7a54c0c11cafe2a0b023a0273e027d38 John Rouillard rouilj@ieee.org 2021-03-02T12:43:19-05:00 2021-03-02T12:43:19-05:00
changeset c547e05d7a54
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description Test case where backend is missing from config.ini.
files
Fix UTC timezone test case if pytz not available; add tests http://hg.code.sf.net:8000/p/roundup/code/#changeset-6cf9f2f49b89df4b9024b1a6820d53e2e370f04e John Rouillard rouilj@ieee.org 2020-12-14T21:25:56-05:00 2020-12-14T21:25:56-05:00
changeset 6cf9f2f49b89
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description Fix UTC timezone test case if pytz not available; add tests

UTC is a special known timezone so it doesn't raise an exception even
if pytz is missing.

Added test case with bogus timezone that raises exception. Added
testcase for EST that is known with and without pytz.
files
Replace deprecated assertEquals with assertEqual and failUnlessRaises http://hg.code.sf.net:8000/p/roundup/code/#changeset-95a366d460654c841c28b1d7d6ba45cda60b1779 John Rouillard rouilj@ieee.org 2019-06-10T21:27:17-04:00 2019-06-10T21:27:17-04:00
changeset 95a366d46065
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description Replace deprecated assertEquals with assertEqual and failUnlessRaises
with assertRaises.
files
Sanity checking improvements. All IntegerNumberOption really have to http://hg.code.sf.net:8000/p/roundup/code/#changeset-765f8c0e99ef2f9d17873f520d3e094f455db5b1 John Rouillard rouilj@ieee.org 2019-06-07T21:53:55-04:00 2019-06-07T21:53:55-04:00
changeset 765f8c0e99ef
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description Sanity checking improvements. All IntegerNumberOption really have to
be positive integers or zero. Replace type with new
IntegerNumberGeqZeroOption class definition to enforce this range.

Use update_option to test now unused IntegerNumberOption and
never used FloatNumberOption.

Test save function, make sure it creates .bak file.

Test a few more configuration option classes.
files
Finish up login rate limit code. Set config item to 0 disables, make http://hg.code.sf.net:8000/p/roundup/code/#changeset-8dbe307bdb57ad8d75d9a9b7513eb3b88509fce3 John Rouillard rouilj@ieee.org 2019-06-07T13:50:57-04:00 2019-06-07T13:50:57-04:00
changeset 8dbe307bdb57
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description Finish up login rate limit code. Set config item to 0 disables, make
sure config item can't be negative integer.
files
Validate that TRACKER_WEB url starts with https:// or http:// and ends http://hg.code.sf.net:8000/p/roundup/code/#changeset-f91da208f26b2d70d9ca83e21c7c83539b70e801 John Rouillard rouilj@ieee.org 2019-06-05T21:11:50-04:00 2019-06-05T21:11:50-04:00
changeset f91da208f26b
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description Validate that TRACKER_WEB url starts with https:// or http:// and ends
with a /.
files
starter tests for roundup/configuration.py http://hg.code.sf.net:8000/p/roundup/code/#changeset-dd642afb444021b893fc2cdba96f2f3c8145b56b John Rouillard rouilj@ieee.org 2016-07-03T21:21:29-04:00 2016-07-03T21:21:29-04:00
changeset dd642afb4440
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description starter tests for roundup/configuration.py
files
[config-0-4-0-branch] I've re-worked the config structure a little so it's simpler http://hg.code.sf.net:8000/p/roundup/code/#changeset-13719594278b25bbb60d88e44b182cbbd9da05f5 Richard Jones richard@users.sourceforge.net 2002-02-06T07:11:13+00:00 2002-02-06T07:11:13+00:00
changeset 13719594278b
branch config-0-4-0-branch
bookmark
tag
user Richard Jones <richard@users.sourceforge.net>
description I've re-worked the config structure a little so it's simpler

(one less file) and added a unit test so we can be sure it's working.
files