Skip to content

Commit

Permalink
Merge pull request #584 from naspeh-sf/master
Browse files Browse the repository at this point in the history
Tests: fix behave tests in children repos
  • Loading branch information
ioanpocol committed Sep 24, 2016
2 parents f918f3b + 1533b32 commit c031cc3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
23 changes: 21 additions & 2 deletions superdesk/tests/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@
readonly_fields = ['display_name', 'password', 'phone', 'first_name', 'last_name']


def setup_before_all(context, config, app_factory):
"""
Keep it for backwards compatibility.
TODO: it needs to be cleaned on each superdesk repo.
"""
setup_before_all.config = config
setup_before_all.app_factory = app_factory


def setup_before_scenario(context, scenario, config, app_factory):
if scenario.status != 'skipped' and 'notesting' in scenario.tags:
config['SUPERDESK_TESTING'] = False
Expand Down Expand Up @@ -78,7 +88,16 @@ def before_all(context):


def before_feature(context, feature):
config = {}
config = getattr(setup_before_all, 'config', None)
if config is not None:
app_factory = setup_before_all.app_factory
else:
# superdesk-aap don't use "setup_before_all" already
config = getattr(setup_before_scenario, 'config', None)
app_factory = getattr(setup_before_scenario, 'app_factory', None)
config = config or {}
app_factory = app_factory or get_app

if AMAZON_CONTAINER_NAME:
config['AMAZON_CONTAINER_NAME'] = AMAZON_CONTAINER_NAME
config['AMAZON_ACCESS_KEY_ID'] = AMAZON_ACCESS_KEY_ID
Expand All @@ -93,7 +112,7 @@ def before_feature(context, feature):
# set the MAX_TRANSMIT_RETRY_ATTEMPT to zero so that transmit does not retry
config['MAX_TRANSMIT_RETRY_ATTEMPT'] = 0
os.environ['BEHAVE_TESTING'] = '1'
tests.setup(context, config)
tests.setup(context, config, app_factory=app_factory)

if 'tobefixed' in feature.tags:
feature.mark_skipped()
Expand Down
1 change: 1 addition & 0 deletions superdesk/tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def env(variable, fallback_value=None):
ARCHIVED_DBNAME = env('ARCHIVED_DBNAME', 'archived')
ARCHIVED_URI = env('ARCHIVED_URI', 'mongodb://localhost/%s' % ARCHIVED_DBNAME)

ELASTICSEARCH_FORCE_REFRESH = True
ELASTICSEARCH_URL = env('ELASTICSEARCH_URL', 'http://localhost:9200')
ELASTICSEARCH_INDEX = env('ELASTICSEARCH_INDEX', 'superdesk')
if env('ELASTIC_PORT'):
Expand Down

0 comments on commit c031cc3

Please sign in to comment.