tests are, uh, mostly passing

This commit is contained in:
stvnrlly
2022-10-05 01:12:35 +00:00
parent 9d5bcdf910
commit 53204c307b
12 changed files with 37 additions and 40 deletions

View File

@@ -34,11 +34,7 @@ from app.models import (
NOTIFICATION_PENDING_VIRUS_CHECK,
)
from tests.app import load_example_csv
from tests.app.db import (
create_job,
create_notification,
create_template,
)
from tests.app.db import create_job, create_notification, create_template
from tests.conftest import set_config

View File

@@ -13,10 +13,7 @@ from app.dao.api_key_dao import save_model_api_key
from app.dao.invited_user_dao import save_invited_user
from app.dao.jobs_dao import dao_create_job
from app.dao.notifications_dao import dao_create_notification
from app.dao.organisation_dao import (
dao_add_service_to_organisation,
dao_create_organisation,
)
from app.dao.organisation_dao import dao_create_organisation
from app.dao.services_dao import dao_add_user_to_service, dao_create_service
from app.dao.templates_dao import dao_create_template
from app.dao.users_dao import create_secret_code, create_user_code

View File

@@ -17,6 +17,7 @@ def mmg_post(client, data):
data=data,
headers=[('Content-Type', 'application/json')])
@pytest.mark.skip(reason="Needs updating for TTS: Firetext removal")
def test_firetext_callback_should_not_need_auth(client, mocker):
mocker.patch('app.notifications.notifications_sms_callback.process_sms_client_response')
@@ -36,6 +37,7 @@ def test_firetext_callback_should_return_400_if_empty_reference(client, mocker):
assert json_resp['result'] == 'error'
assert json_resp['message'] == ['Firetext callback failed: reference missing']
@pytest.mark.skip(reason="Needs updating for TTS: Firetext removal")
def test_firetext_callback_should_return_400_if_no_reference(client, mocker):
data = 'mobile=441234123123&status=0&time=2016-03-10 14:17:00'
@@ -45,6 +47,7 @@ def test_firetext_callback_should_return_400_if_no_reference(client, mocker):
assert json_resp['result'] == 'error'
assert json_resp['message'] == ['Firetext callback failed: reference missing']
@pytest.mark.skip(reason="Needs updating for TTS: Firetext removal")
def test_firetext_callback_should_return_400_if_no_status(client, mocker):
data = 'mobile=441234123123&time=2016-03-10 14:17:00&reference=notification_id'
@@ -54,6 +57,7 @@ def test_firetext_callback_should_return_400_if_no_status(client, mocker):
assert json_resp['result'] == 'error'
assert json_resp['message'] == ['Firetext callback failed: status missing']
@pytest.mark.skip(reason="Needs updating for TTS: Firetext removal")
def test_firetext_callback_should_return_200_and_call_task_with_valid_data(client, mocker):
mock_celery = mocker.patch(
@@ -70,6 +74,7 @@ def test_firetext_callback_should_return_200_and_call_task_with_valid_data(clien
queue='sms-callbacks',
)
@pytest.mark.skip(reason="Needs updating for TTS: Firetext removal")
def test_firetext_callback_including_a_code_should_return_200_and_call_task_with_valid_data(client, mocker):
mock_celery = mocker.patch(
@@ -86,6 +91,7 @@ def test_firetext_callback_including_a_code_should_return_200_and_call_task_with
queue='sms-callbacks',
)
@pytest.mark.skip(reason="Needs updating for TTS: MMG removal")
def test_mmg_callback_should_not_need_auth(client, mocker, sample_notification):
mocker.patch('app.notifications.notifications_sms_callback.process_sms_client_response')
@@ -98,6 +104,7 @@ def test_mmg_callback_should_not_need_auth(client, mocker, sample_notification):
response = mmg_post(client, data)
assert response.status_code == 200
@pytest.mark.skip(reason="Needs updating for TTS: MMG removal")
def test_process_mmg_response_returns_400_for_malformed_data(client):
data = json.dumps({"reference": "mmg_reference",
@@ -114,6 +121,7 @@ def test_process_mmg_response_returns_400_for_malformed_data(client):
assert "{} callback failed: {} missing".format('MMG', 'status') in json_data['message']
assert "{} callback failed: {} missing".format('MMG', 'CID') in json_data['message']
@pytest.mark.skip(reason="Needs updating for TTS: MMG removal")
def test_mmg_callback_should_return_200_and_call_task_with_valid_data(client, mocker):
mock_celery = mocker.patch(

View File

@@ -5,9 +5,8 @@ from app.commands import (
populate_annual_billing_with_defaults,
)
from app.dao.inbound_numbers_dao import dao_get_available_inbound_numbers
from app.dao.services_dao import dao_add_user_to_service
from app.models import AnnualBilling
from tests.app.db import create_annual_billing, create_service, create_user
from tests.app.db import create_annual_billing, create_service
def test_insert_inbound_numbers_from_file(notify_db_session, notify_api, tmpdir):

View File

@@ -60,7 +60,7 @@ def test_load_config_if_cloudfoundry_not_available(reload_config):
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) == 18
assert len(queues) == 17
assert set([
QueueNames.PRIORITY,
QueueNames.PERIODIC,

View File

@@ -5,7 +5,7 @@ import pytest
import sqlalchemy
from alembic.command import upgrade
from alembic.config import Config
from flask import Flask
from flask import Flask, current_app
from app import create_app, db
from app.dao.provider_details_dao import get_provider_details_by_identifier