flake8 fixes

a stricter flake8 bump. mostly things around f strings and format
strings, but a couple of bad placeholder names in loops
This commit is contained in:
Leo Hemsted
2020-12-07 15:15:50 +00:00
parent d6555d887c
commit 9502f17d84
8 changed files with 23 additions and 21 deletions

View File

@@ -253,7 +253,7 @@ def test_should_allow_valid_token_when_service_has_multiple_keys(client, sample_
save_model_api_key(api_key)
token = __create_token(sample_api_key.service_id)
response = client.get(
'/notifications'.format(str(sample_api_key.service_id)),
'/notifications',
headers={'Authorization': 'Bearer {}'.format(token)})
assert response.status_code == 200

View File

@@ -412,7 +412,7 @@ def test_update_broadcast_message_status_rejects_approval_from_creator(
)
assert mock_task.called is False
assert f'cannot approve their own broadcast' in response['message']
assert 'cannot approve their own broadcast' in response['message']
def test_update_broadcast_message_status_rejects_approval_of_broadcast_with_no_areas(
@@ -523,7 +523,7 @@ def test_update_broadcast_message_status_rejects_approval_from_user_not_on_that_
)
assert mock_task.called is False
assert f'cannot approve broadcast' in response['message']
assert 'cannot approve broadcast' in response['message']
@pytest.mark.parametrize('current_status, new_status', [

View File

@@ -354,9 +354,11 @@ def test_check_is_message_too_long_passes_for_long_email(sample_service):
with pytest.raises(BadRequestError) as e:
check_is_message_too_long(template_with_content)
assert e.value.status_code == 400
expected_message = f'Your message is too long. ' \
f'Emails cannot be longer than 1000000 bytes. ' \
f'Your message is 1000084 bytes.'
expected_message = (
'Your message is too long. ' +
'Emails cannot be longer than 1000000 bytes. ' +
'Your message is 1000084 bytes.'
)
assert e.value.message == expected_message
assert e.value.fields == []

View File

@@ -25,7 +25,7 @@ def test_url_for_get_service_by_id(notify_api):
def test_url_for_create_service(notify_api):
with notify_api.test_request_context():
url = url_for('service.create_service')
assert str(url) == '/service'.format(service_id)
assert str(url) == '/service'
def test_url_for_update_service(notify_api):