diff --git a/app/config.py b/app/config.py index 6fc83946f..68b780290 100644 --- a/app/config.py +++ b/app/config.py @@ -90,7 +90,7 @@ class Config(object): ], } - FEATURE_SOCKET_ENABLED = getenv("FEATURE_SOCKET_ENABLED", "true") == "true" + FEATURE_SOCKET_ENABLED = getenv("FEATURE_SOCKET_ENABLED", "false") == "true" def _s3_credentials_from_env(bucket_prefix): diff --git a/app/main/views/jobs.py b/app/main/views/jobs.py index 68d6b3d96..e58651f8e 100644 --- a/app/main/views/jobs.py +++ b/app/main/views/jobs.py @@ -1,7 +1,5 @@ # -*- coding: utf-8 -*- -import json import os -import time from functools import partial from flask import ( @@ -22,7 +20,6 @@ from markupsafe import Markup from app import ( current_service, format_datetime_table, - job_api_client, notification_api_client, service_api_client, ) diff --git a/tests/app/main/views/test_jobs.py b/tests/app/main/views/test_jobs.py index 3f1db6f5f..97b123f79 100644 --- a/tests/app/main/views/test_jobs.py +++ b/tests/app/main/views/test_jobs.py @@ -358,7 +358,11 @@ def test_should_show_scheduled_job( assert page.select("main p a")[0]["href"] == url_for( "main.message_status", ) - assert page.select_one("main button[type=submit]").text.strip() == "Cancel sending" + # Test that both buttons are present + buttons = page.select("main button[type=submit]") + button_texts = [b.text.strip() for b in buttons] + assert "Refresh Status" in button_texts + assert "Cancel sending" in button_texts def test_should_cancel_job( @@ -523,25 +527,10 @@ def test_poll_status_endpoint( "main.view_job_status_poll", service_id=service_one["id"], job_id=fake_uuid, + _expected_status=410, ) - assert response.status_code == 200 - data = json.loads(response.get_data(as_text=True)) - - expected_keys = { - "sent_count", - "failed_count", - "pending_count", - "total_count", - "finished", - } - assert set(data.keys()) == expected_keys - - assert data["sent_count"] == 90 - assert data["failed_count"] == 10 - assert data["pending_count"] == 0 - assert data["total_count"] == 100 - assert data["finished"] is True + assert response.status_code == 410 def test_poll_status_with_zero_notifications( @@ -566,13 +555,10 @@ def test_poll_status_with_zero_notifications( "main.view_job_status_poll", service_id=service_one["id"], job_id=fake_uuid, + _expected_status=410, ) - assert response.status_code == 200 - data = json.loads(response.get_data(as_text=True)) - - assert data["total_count"] == 0 - assert data["finished"] is True + assert response.status_code == 410 def test_poll_status_endpoint_does_not_query_notifications_table( @@ -601,16 +587,10 @@ def test_poll_status_endpoint_does_not_query_notifications_table( "main.view_job_status_poll", service_id=service_one["id"], job_id=fake_uuid, + _expected_status=410, ) - assert response.status_code == 200 + assert response.status_code == 410 - # Verify no notifications were fetched + # Verify no notifications were fetched (since endpoint is disabled) mock_get_notifications.assert_not_called() - - data = json.loads(response.get_data(as_text=True)) - assert data["total_count"] == 500 - assert data["sent_count"] == 300 - assert data["failed_count"] == 50 - assert data["pending_count"] == 150 - assert data["finished"] is False