Repository :
http://git.fedorahosted.org/cgit/copr.git
On branch : bkabrda-workspace
---------------------------------------------------------------
commit ff3b1f51cd33a38a6ef6fc24c450bd165dbee6e4
Author: Bohuslav Kabrda <bkabrda(a)redhat.com>
Date: Wed Nov 21 08:48:59 2012 +0100
Few changes to be able to test forms (no csrf, test modules can't import anything
from coprs, as that instantiates new app outside of test env
---------------------------------------------------------------
wsgi/coprs/config.py | 1 +
wsgi/tests/coprs_test_case.py | 3 ++-
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/wsgi/coprs/config.py b/wsgi/coprs/config.py
index e07f5d3..7dde9d7 100644
--- a/wsgi/coprs/config.py
+++ b/wsgi/coprs/config.py
@@ -25,6 +25,7 @@ class DevelopmentConfig(Config):
SQLALCHEMY_ECHO = True
class UnitTestConfig(Config):
+ CSRF_ENABLED = False
DATABASE = os.path.abspath('tests/data/copr.db')
OPENID_STORE = os.path.abspath('tests/data/openid_store')
diff --git a/wsgi/tests/coprs_test_case.py b/wsgi/tests/coprs_test_case.py
index 45b5572..0c679e5 100644
--- a/wsgi/tests/coprs_test_case.py
+++ b/wsgi/tests/coprs_test_case.py
@@ -11,8 +11,9 @@ class CoprsTestCase(object):
def setup_method(self, method):
self.tc = coprs.app.test_client()
self.app = coprs.app
+ self.app.testing = True
self.db = coprs.db
-
+ self.models = models
# create datadir if it doesn't exist
datadir = os.path.commonprefix([self.app.config['DATABASE'],
self.app.config['OPENID_STORE']])
if not os.path.exists(datadir):