Skip to content

Commit

Permalink
Improve test_wfst_concurrency test
Browse files Browse the repository at this point in the history
  • Loading branch information
index-git committed May 11, 2021
1 parent 7444b7c commit 6597478
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions src/layman/requests_concurrency_test.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from test import process_client
import time

from test import process_client, assert_util
from test.data import wfs as data_wfs
import requests
import pytest

from layman import settings
from layman import celery, settings
from layman.common import empty_method_returns_true


Expand All @@ -19,23 +21,48 @@ def test_wfst_concurrency():
'Content-type': 'text/xml',
}

process_client.publish_workspace_layer(workspace, layer,)
process_client.publish_workspace_layer(workspace, layer, )

queue = celery.get_run_after_chain_queue(workspace, process_client.LAYER_TYPE, layer)
assert not queue

r = requests.post(rest_url,
data=data_xml,
headers=headers)
assert r.status_code == 200, r.text

queue = celery.get_run_after_chain_queue(workspace, process_client.LAYER_TYPE, layer)
assert len(queue) == 0, queue

process_client.patch_workspace_layer(workspace, layer, title='New title', check_response_fn=empty_method_returns_true)
queue = celery.get_run_after_chain_queue(workspace, process_client.LAYER_TYPE, layer)
assert len(queue) == 1, queue
assert queue == ['layman.util::patch_after_wfst', ]

r = requests.post(rest_url,
data=data_xml,
headers=headers)
assert r.status_code == 200, r.text

queue = celery.get_run_after_chain_queue(workspace, process_client.LAYER_TYPE, layer)
assert len(queue) == 1, queue
assert queue == ['layman.util::patch_after_wfst', ]

r = requests.post(rest_url,
data=data_xml,
headers=headers)
assert r.status_code == 200, r.text

queue = celery.get_run_after_chain_queue(workspace, process_client.LAYER_TYPE, layer)
assert len(queue) == 1, queue
assert queue == ['layman.util::patch_after_wfst', ]

time.sleep(3)

expected_bbox = (1571000.0, 6268800.0, 1572590.8542062, 6269876.33561699)
assert_util.assert_all_sources_bbox(workspace, layer, expected_bbox)

process_client.delete_workspace_layer(workspace, layer, )

queue = celery.get_run_after_chain_queue(workspace, process_client.LAYER_TYPE, layer)
assert not queue, queue

0 comments on commit 6597478

Please sign in to comment.