mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Make new service current service on first use
When you add a new service, it’s probably the one you want to do stuff with. When you get invited, the service you’ve been invited to is probably the one you want to use. This commit adds the ID of the new service or service you’ve been invited to to the session.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from flask import url_for
|
||||
from flask import url_for, session
|
||||
|
||||
import app
|
||||
|
||||
@@ -25,15 +25,18 @@ def test_should_add_service_and_redirect_to_next_page(app_,
|
||||
response = client.post(
|
||||
url_for('main.add_service'),
|
||||
data={'name': 'testing the post'})
|
||||
assert mock_get_services.called
|
||||
mock_create_service.assert_called_once_with(
|
||||
service_name='testing the post',
|
||||
active=False,
|
||||
message_limit=app_.config['DEFAULT_SERVICE_LIMIT'],
|
||||
restricted=True,
|
||||
user_id=api_user_active.id,
|
||||
email_from='testing.the.post'
|
||||
)
|
||||
assert session['service_id'] == 101
|
||||
assert response.status_code == 302
|
||||
assert response.location == url_for('main.tour', page=1, _external=True)
|
||||
assert mock_get_services.called
|
||||
mock_create_service.asset_called_once_with(service_name='testing the post',
|
||||
active=False,
|
||||
limit=app_.config['DEFAULT_SERVICE_LIMIT'],
|
||||
restricted=True,
|
||||
user_id=api_user_active.id,
|
||||
email_from='testing.the.post')
|
||||
|
||||
|
||||
def test_should_return_form_errors_when_service_name_is_empty(app_,
|
||||
|
||||
Reference in New Issue
Block a user