1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-05-03 00:43:07 +00:00

unit tests (modules): use f-strings (#10992)

* unit tests (modules): use f-strings

* Apply suggestions from code review
This commit is contained in:
Alexei Znamensky 2025-10-27 11:08:33 +13:00 committed by GitHub
parent f6781f654e
commit e177d1e61a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 140 additions and 159 deletions

View file

@ -62,7 +62,7 @@ def test_acl_create(api_request_mock, project, prefix):
# should have done GET → POST → GET
assert api_request_mock.call_count == 3
args, kwargs = api_request_mock.call_args_list[1]
assert kwargs['endpoint'] == "%s/%s.aclpolicy" % (prefix, name)
assert kwargs['endpoint'] == f"{prefix}/{name}.aclpolicy"
assert kwargs['method'] == 'POST'
@ -91,7 +91,7 @@ def test_acl_unchanged(api_request_mock, project, prefix):
# only a single GET
assert api_request_mock.call_count == 1
args, kwargs = api_request_mock.call_args
assert kwargs['endpoint'] == "%s/%s.aclpolicy" % (prefix, name)
assert kwargs['endpoint'] == f"{prefix}/{name}.aclpolicy"
# default method is GET
assert kwargs.get('method', 'GET') == 'GET'
@ -123,7 +123,7 @@ def test_acl_remove(api_request_mock, project, prefix):
# GET → DELETE
assert api_request_mock.call_count == 2
args, kwargs = api_request_mock.call_args_list[1]
assert kwargs['endpoint'] == "%s/%s.aclpolicy" % (prefix, name)
assert kwargs['endpoint'] == f"{prefix}/{name}.aclpolicy"
assert kwargs['method'] == 'DELETE'
@ -151,5 +151,5 @@ def test_acl_remove_nonexistent(api_request_mock, project, prefix):
# only the initial GET
assert api_request_mock.call_count == 1
args, kwargs = api_request_mock.call_args
assert kwargs['endpoint'] == "%s/%s.aclpolicy" % (prefix, name)
assert kwargs['endpoint'] == f"{prefix}/{name}.aclpolicy"
assert kwargs.get('method', 'GET') == 'GET'