placement: s/None/null/ in consumer conflict msg

The placement API had a message complaining that it was "expecting None"
which is python-speak when it should be JSON speak.  This change
corrects the message and adds a gabbi test for it.

Change-Id: Ibfb3d581588c8eb954a9faca19d9cb26d2c28861
Closes-Bug: #1778071
This commit is contained in:
Eric Fried 2018-06-21 09:16:17 -05:00
parent 9882a60e69
commit 07460610f8
2 changed files with 16 additions and 1 deletions

View File

@ -640,7 +640,7 @@ def ensure_consumer(ctx, consumer_uuid, project_id, user_id,
if consumer_generation is not None:
raise webob.exc.HTTPConflict(
_('consumer generation conflict - '
'expected None but got %s') % consumer_generation)
'expected null but got %s') % consumer_generation)
# No such consumer. This is common for new allocations. Create the
# consumer record
try:

View File

@ -50,6 +50,21 @@ tests:
response_strings:
- JSON does not validate
- name: new version gen is not null no existing
PUT: /allocations/22222222-2222-2222-2222-222222222222
data:
allocations:
$ENVIRON['RP_UUID']:
resources:
DISK_GB: 10
project_id: $ENVIRON['PROJECT_ID']
user_id: $ENVIRON['USER_ID']
consumer_generation: 5
status: 409
response_strings:
- consumer generation conflict
- expected null but got 5
- name: new version gen is None no existing
PUT: /allocations/22222222-2222-2222-2222-222222222222
data: