Moved PostgreSQL connection settings into a dedicated configuration file. This makes easier to use different connection parameters since it's no longer needed to change the python source code. --- backend/test/db_settings.ini | 5 +++++ backend/test/runtests-postgresql.py | 12 ++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 backend/test/db_settings.ini
diff --git a/backend/test/db_settings.ini b/backend/test/db_settings.ini new file mode 100644 index 0000000..10e417f --- /dev/null +++ b/backend/test/db_settings.ini @@ -0,0 +1,5 @@ +[postgresql] +host: localhost +user: dgoodwin +password: spacewalk +database: spacewalk diff --git a/backend/test/runtests-postgresql.py b/backend/test/runtests-postgresql.py index 427c2f7..0a10ec7 100755 --- a/backend/test/runtests-postgresql.py +++ b/backend/test/runtests-postgresql.py @@ -23,6 +23,7 @@ import os import sys import unittest +from ConfigParser import ConfigParser from spacewalk.server import rhnSQL # Import all test modules here: @@ -32,10 +33,13 @@ sys.path.insert( ) import dbtests -PG_HOST = "localhost" -PG_USER = "dgoodwin" -PG_PASSWORD = "spacewalk" -PG_DATABASE = "spacewalk" +config = ConfigParser() +config.read(os.path.dirname(os.path.abspath(__file__)) + "/db_settings.ini") + +PG_HOST = config.get('postgresql', 'host') +PG_USER = config.get('postgresql', 'user') +PG_PASSWORD= config.get('postgresql', 'password') +PG_DATABASE = config.get('postgresql', 'database') rhnSQL.initDB(backend="postgresql", host=PG_HOST, username=PG_USER, password=PG_PASSWORD, database=PG_DATABASE) -- 1.8.1.4 _______________________________________________ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel