pylint: fix redundant-keyword-arg error

pylint complains 'name' argument is redundant
in positional and keyword arguments.
The existence of 'name' in kwargs is checked before passing to
api.keystone.tenant_create, so we can pass 'name' as part of kwargs.

Change-Id: Ice09cecb21217b042d44a8c1dda7a4736e2b391b
This commit is contained in:
Akihiro Motoki 2018-12-10 04:11:25 +09:00
parent c9536342c2
commit 150dcc3fb0
3 changed files with 5 additions and 5 deletions

View File

@ -15,7 +15,6 @@ disable=
no-member,
not-callable,
raising-non-exception,
redundant-keyword-arg,
unexpected-keyword-arg,
# "W" Warnings for stylistic problems or minor programming issues
arguments-differ,

View File

@ -456,7 +456,6 @@ class Projects(generic.View):
raise rest_utils.AjaxError(400, '"name" is required')
new_project = api.keystone.tenant_create(
request,
kwargs.pop('name'),
**kwargs
)
return rest_utils.CreatedResponse(

View File

@ -606,6 +606,7 @@ class KeystoneRestTestCase(test.TestCase):
'"domain_id": "domain123", "description": "sekrit", '
'"enabled": false}',
{
'name': 'bob',
'description': 'sekrit',
'domain': 'domain123',
'enabled': False
@ -616,6 +617,7 @@ class KeystoneRestTestCase(test.TestCase):
self._test_project_create(
'{"name": "bob"}',
{
'name': 'bob',
'description': None,
'domain': None,
'enabled': True
@ -623,7 +625,7 @@ class KeystoneRestTestCase(test.TestCase):
)
@test.create_mocks({api.keystone: ['tenant_create']})
def _test_project_create(self, supplied_body, expected_call):
def _test_project_create(self, supplied_body, expected_args):
request = self.mock_rest_request(body=supplied_body)
self.mock_tenant_create.return_value.id = 'project123'
self.mock_tenant_create.return_value.to_dict.return_value = {
@ -636,8 +638,8 @@ class KeystoneRestTestCase(test.TestCase):
'/api/keystone/projects/project123')
self.assertEqual(response.json,
{"id": "project123", "name": "bob"})
self.mock_tenant_create.assert_called_once_with(request, 'bob',
**expected_call)
self.mock_tenant_create.assert_called_once_with(request,
**expected_args)
@test.create_mocks({api.keystone: ['tenant_delete']})
def test_project_delete_many(self):