Refactor code

- Created TaskNames for DVLA_FILES rather than have DVLA_FILES in QueueNames
- Removed PROCESS_FTP from all_queues() as this was causing problems in picking up letter job tasks
- Created test to ensure that we don't arbitrarily add queue names to all_queues
This commit is contained in:
Ken Tsang
2017-08-22 15:49:56 +01:00
parent 41fce57932
commit 4fb5e68ce7
5 changed files with 28 additions and 7 deletions

View File

@@ -5,6 +5,7 @@ from unittest import mock
import pytest
from app import config
from app.config import QueueNames
def cf_conf():
@@ -57,3 +58,20 @@ def test_load_config_if_cloudfoundry_not_available(monkeypatch, reload_config):
def test_cloudfoundry_config_has_different_defaults():
# these should always be set on Sandbox
assert config.Sandbox.REDIS_ENABLED is False
def test_queue_names_all_queues_correct():
# Need to ensure that all_queues() only returns queue names used in API
queues = QueueNames.all_queues()
assert len(queues) == 10
assert set([QueueNames.PRIORITY,
QueueNames.PERIODIC,
QueueNames.DATABASE,
QueueNames.SEND_SMS,
QueueNames.SEND_EMAIL,
QueueNames.RESEARCH_MODE,
QueueNames.STATISTICS,
QueueNames.JOBS,
QueueNames.RETRY,
QueueNames.NOTIFY
]) == set(queues)