Skip to content

Commit

Permalink
tests: model signal connection SQLAlchemy 2.2
Browse files Browse the repository at this point in the history
Signed-off-by: Diego Rodriguez <diego.rodriguez@cern.ch>
Co-authored-by: Alexander Ioannidis <a.ioannidis@cern.ch>
  • Loading branch information
2 people authored and lnielsen committed Mar 7, 2017
1 parent f75074b commit 665c22a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ def remove_schema(sender, json=None, record=None, **kwargs):
if '$schema' in json:
del json['$schema']

models_committed.connect(process_models_committed_signal, sender=app)

with app.app_context():
# NOTE: We have to use `db.get_app()` because Flask-SQLAlchemy v2.2
# changed the way it picks a sender for the model signals.
models_committed.connect(process_models_committed_signal,
sender=db.get_app())
with app.app_context():

current_search_client.indices.delete_alias('_all', '_all',
Expand Down Expand Up @@ -85,7 +88,7 @@ def remove_schema(sender, json=None, record=None, **kwargs):

record_indexer = RecordIndexer(queue=queue)
result = record_indexer.process_bulk_queue()
assert 2 == len(list(result))
assert (2, 0) == result

response = current_search_client.get(
index='records-default-v1.0.0',
Expand Down

0 comments on commit 665c22a

Please sign in to comment.