Creating new user does not require project
When creating a new user, adding the user to a project is optional. The REST api needs to respect this. Change-Id: I2345476afcb3e0df27e50dabf5d19ec2b0f4b1dc Closes-Bug: #1487251
This commit is contained in:
parent
0c91a18231
commit
cc2cdc01f8
|
@ -88,7 +88,7 @@ class Users(generic.View):
|
|||
name=request.DATA['name'],
|
||||
email=request.DATA.get('email') or None,
|
||||
password=request.DATA.get('password'),
|
||||
project=request.DATA.get('project_id'),
|
||||
project=request.DATA.get('project_id') or None,
|
||||
enabled=True,
|
||||
domain=domain.id
|
||||
)
|
||||
|
|
|
@ -122,6 +122,21 @@ class KeystoneRestTestCase(test.TestCase):
|
|||
}
|
||||
)
|
||||
|
||||
def test_user_create_no_project(self):
|
||||
self._test_user_create(
|
||||
'{"name": "bob", '
|
||||
'"password": "sekrit", "project_id": "", '
|
||||
'"email": "spam@company.example"}',
|
||||
{
|
||||
'name': 'bob',
|
||||
'password': 'sekrit',
|
||||
'email': 'spam@company.example',
|
||||
'project': None,
|
||||
'domain': 'the_domain',
|
||||
'enabled': True
|
||||
}
|
||||
)
|
||||
|
||||
def test_user_create_partial(self):
|
||||
self._test_user_create(
|
||||
'{"name": "bob"}',
|
||||
|
|
Loading…
Reference in New Issue