mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-25 00:33:58 -04:00
Merge pull request #2261 from alphagov/robots.txt
Serve robots.txt from the admin app
This commit is contained in:
@@ -26,6 +26,17 @@ def index():
|
|||||||
return render_template('views/signedout.html')
|
return render_template('views/signedout.html')
|
||||||
|
|
||||||
|
|
||||||
|
@main.route('/robots.txt')
|
||||||
|
def robots():
|
||||||
|
return (
|
||||||
|
'User-agent: *\n'
|
||||||
|
'Disallow: /sign-in\n'
|
||||||
|
'Disallow: /support\n'
|
||||||
|
'Disallow: /support/\n'
|
||||||
|
'Disallow: /register\n'
|
||||||
|
), 200, {'Content-Type': 'text/plain'}
|
||||||
|
|
||||||
|
|
||||||
@main.route('/error/<int:status_code>')
|
@main.route('/error/<int:status_code>')
|
||||||
def error(status_code):
|
def error(status_code):
|
||||||
if status_code >= 500:
|
if status_code >= 500:
|
||||||
|
|||||||
@@ -195,6 +195,7 @@ class HeaderNavigation(Navigation):
|
|||||||
'resend_email_verification',
|
'resend_email_verification',
|
||||||
'resume_service',
|
'resume_service',
|
||||||
'revoke_api_key',
|
'revoke_api_key',
|
||||||
|
'robots',
|
||||||
'send_messages',
|
'send_messages',
|
||||||
'send_notification',
|
'send_notification',
|
||||||
'send_one_off',
|
'send_one_off',
|
||||||
@@ -453,6 +454,7 @@ class MainNavigation(Navigation):
|
|||||||
'resend_email_verification',
|
'resend_email_verification',
|
||||||
'resume_service',
|
'resume_service',
|
||||||
'roadmap',
|
'roadmap',
|
||||||
|
'robots',
|
||||||
'security',
|
'security',
|
||||||
'send_notification',
|
'send_notification',
|
||||||
'service_dashboard_updates',
|
'service_dashboard_updates',
|
||||||
@@ -641,6 +643,7 @@ class CaseworkNavigation(Navigation):
|
|||||||
'resume_service',
|
'resume_service',
|
||||||
'revoke_api_key',
|
'revoke_api_key',
|
||||||
'roadmap',
|
'roadmap',
|
||||||
|
'robots',
|
||||||
'security',
|
'security',
|
||||||
'send_messages',
|
'send_messages',
|
||||||
'send_notification',
|
'send_notification',
|
||||||
@@ -863,6 +866,7 @@ class OrgNavigation(Navigation):
|
|||||||
'resume_service',
|
'resume_service',
|
||||||
'revoke_api_key',
|
'revoke_api_key',
|
||||||
'roadmap',
|
'roadmap',
|
||||||
|
'robots',
|
||||||
'security',
|
'security',
|
||||||
'send_messages',
|
'send_messages',
|
||||||
'send_notification',
|
'send_notification',
|
||||||
|
|||||||
@@ -40,6 +40,20 @@ def test_logged_in_user_redirects_to_choose_account(
|
|||||||
assert response.location == url_for('main.choose_account', _external=True)
|
assert response.location == url_for('main.choose_account', _external=True)
|
||||||
|
|
||||||
|
|
||||||
|
def test_robots(client):
|
||||||
|
assert url_for('main.robots') == '/robots.txt'
|
||||||
|
response = client.get(url_for('main.robots'))
|
||||||
|
assert response.headers['Content-Type'] == 'text/plain'
|
||||||
|
assert response.status_code == 200
|
||||||
|
assert response.get_data(as_text=True) == (
|
||||||
|
'User-agent: *\n'
|
||||||
|
'Disallow: /sign-in\n'
|
||||||
|
'Disallow: /support\n'
|
||||||
|
'Disallow: /support/\n'
|
||||||
|
'Disallow: /register\n'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('view', [
|
@pytest.mark.parametrize('view', [
|
||||||
'cookies', 'privacy', 'using_notify', 'pricing', 'terms', 'integration_testing', 'roadmap',
|
'cookies', 'privacy', 'using_notify', 'pricing', 'terms', 'integration_testing', 'roadmap',
|
||||||
'features', 'callbacks', 'documentation', 'security'
|
'features', 'callbacks', 'documentation', 'security'
|
||||||
|
|||||||
Reference in New Issue
Block a user