]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
Rework configurable 'PW_TEST_DB_xxx' settings
authorStephen Finucane <stephen.finucane@intel.com>
Thu, 12 Nov 2015 05:17:45 +0000 (05:17 +0000)
committerStephen Finucane <stephen.finucane@intel.com>
Sat, 21 Nov 2015 17:07:40 +0000 (17:07 +0000)
There are a number of environment variables that users can set to
configure different aspects of their testing environment. Rework these
like so:

* People use PostgreSQL, so make it as easy as possible for them to
  develop and test against it. Add a 'PW_TEST_DB_TYPE' setting
* Attempt to use defaults for the username and password in settings
* Allow the user to configure the database name, if they so wish

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
patchwork/settings/dev.py
requirements-test.txt

index e93249c6929e4e962952b1277fef4cd9452808ef..0f73a1355734b0612aeef8c87b862806077ffbb3 100644 (file)
@@ -35,12 +35,15 @@ DATABASES = {
         'ENGINE': 'django.db.backends.mysql',
         'HOST': 'localhost',
         'PORT': '',
-        'USER': os.environ['PW_TEST_DB_USER'],
-        'PASSWORD': os.environ['PW_TEST_DB_PASS'],
-        'NAME': 'patchwork',
+        'USER': os.getenv('PW_TEST_DB_USER', 'patchwork'),
+        'PASSWORD': os.getenv('PW_TEST_DB_PASS', 'password'),
+        'NAME': os.getenv('PW_TEST_DB_NAME', 'patchwork'),
     },
 }
 
+if os.getenv('PW_TEST_DB_TYPE', None) == 'postgre':
+    DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2'
+
 if django.VERSION < (1, 7):
     DATABASES['default']['TEST_CHARSET'] = 'utf8'
 else:
index 035ce131edea9f37e7927cfc2b1ec41eebca7f35..e6c34ec36e032623574e6aed559cea7735ed8d83 100644 (file)
@@ -1,3 +1,4 @@
 MySQL-python==1.2.5
+psycopg2==2.6.1
 python-dateutil==1.5
 selenium