mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 02:42:26 -05:00
View function for request go live was always calling update service.
Actually this should be no op until whatever workflow will take place in the real world is implemented. For the moment just display flash message to say request being processed and do nothing.
This commit is contained in:
@@ -1,14 +1,30 @@
|
||||
from flask import (
|
||||
render_template, redirect, request, url_for, abort, session)
|
||||
from flask_login import (login_required, current_user)
|
||||
render_template,
|
||||
redirect,
|
||||
request,
|
||||
url_for,
|
||||
abort,
|
||||
session,
|
||||
flash
|
||||
)
|
||||
|
||||
from flask_login import (
|
||||
login_required,
|
||||
current_user
|
||||
)
|
||||
|
||||
from notifications_python_client.errors import HTTPError
|
||||
|
||||
from app.main.dao.services_dao import (
|
||||
get_service_by_id,
|
||||
delete_service,
|
||||
update_service
|
||||
)
|
||||
|
||||
from app.main import main
|
||||
from app.utils import user_has_permissions
|
||||
from app.main.dao.services_dao import (
|
||||
get_service_by_id, delete_service, update_service)
|
||||
from app.main.dao.users_dao import verify_password
|
||||
from app.main.forms import ConfirmPasswordForm, ServiceNameForm
|
||||
from notifications_python_client.errors import HTTPError
|
||||
|
||||
|
||||
@main.route("/services/<service_id>/service-settings")
|
||||
@@ -102,8 +118,8 @@ def service_request_to_go_live(service_id):
|
||||
service_id=service_id
|
||||
)
|
||||
elif request.method == 'POST':
|
||||
service['restricted']
|
||||
update_service(service)
|
||||
flash('Thanks your request to go live is being processed', 'default')
|
||||
# TODO implement whatever this action would do in the real world
|
||||
return redirect(url_for('.service_settings', service_id=service_id))
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from flask import (url_for, session)
|
||||
from flask import url_for
|
||||
from tests import validate_route_permission
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
|
||||
def test_should_show_overview(app_,
|
||||
@@ -134,7 +135,6 @@ def test_should_show_request_to_go_live(app_,
|
||||
def test_should_redirect_after_request_to_go_live(app_,
|
||||
api_user_active,
|
||||
mock_get_service,
|
||||
mock_update_service,
|
||||
mock_get_user,
|
||||
mock_get_user_by_email,
|
||||
mock_login,
|
||||
@@ -151,7 +151,16 @@ def test_should_redirect_after_request_to_go_live(app_,
|
||||
'main.service_settings', service_id=service_id, _external=True)
|
||||
assert settings_url == response.location
|
||||
assert mock_get_service.called
|
||||
assert mock_update_service.called
|
||||
|
||||
with app_.test_client() as client:
|
||||
client.login(api_user_active)
|
||||
service_id = 123
|
||||
response = client.post(url_for(
|
||||
'main.service_request_to_go_live', service_id=service_id), follow_redirects=True)
|
||||
|
||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||
flash_banner = page.find('div', class_='banner-default').string.strip()
|
||||
assert flash_banner == 'Thanks your request to go live is being processed'
|
||||
|
||||
|
||||
def test_should_show_status_page(app_,
|
||||
|
||||
Reference in New Issue
Block a user