Issue #700
closed400 is never raised during user creation
Description
Description of problem:
http://pulp-dev-guide.readthedocs.org/en/latest/integration/rest-api/user/cud.html#create-a-user
400 - if one or more of the parameters is invalid
]$ curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: webpy" -X POST -k -u admin:admin -d '{"invalid":"1234", "login":"test123", "pasword":"xxxx"}' "https://localhost/pulp/api/v2/users/"
HTTP/1.1 201 Created
Date: Mon, 16 Feb 2015 13:48:00 GMT
Server: Apache/2.4.10 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.5 Python/2.7.5
Location: test123
Content-Length: 187
Content-Type: application/json
{"_id": {"$oid": "54e1f51045ef480d69f3b141"}, "name": "test123", "roles": [], "_ns": "users", "login": "test123", "id": "54e1f51045ef480d69f3b141", "_href": "/pulp/api/v2/users/test123/"}[ipanova@ina pulp]$
Version-Release number of selected component (if applicable):
How reproducible:
Steps to Reproduce:
1.
2.
3.
Actual results:
Expected results:
Additional info:
+ This bug was cloned from Bugzilla Bug #1193059 +
Updated by ipanova@redhat.com over 8 years ago
same issue with user update:
$ curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: webpy" -X PUT -k -u admin:admin -d '{"delta":{"invalid": "1234"}}' "https://localhost/pulp/api/v2/users/xxx/"
HTTP/1.1 200 OK
Date: Mon, 16 Feb 2015 13:54:00 GMT
Server: Apache/2.4.10 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.5 Python/2.7.5
Content-Length: 106
Content-Type: application/json
{"_id": {"$oid": "54db25b245ef484d5eec799f"}, "name": "haha", "roles": [], "_ns": "users", "login": "xxx"}
+ This comment was cloned from Bugzilla #1193059 comment 1 +
Updated by ipanova@redhat.com over 8 years ago
https://github.com/pulp/pulp/pull/1645
+ This comment was cloned from Bugzilla #1193059 comment 2 +
Updated by dkliban@redhat.com over 8 years ago
- Status changed from MODIFIED to 5
Updated by igulina@redhat.com over 8 years ago
- Status changed from 5 to 6
>> rpm -qa pulp-server
pulp-server-2.7.0-0.3.beta.el7.noarch
User creation with valid parameters:
curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: webpy" -X POST -k -u admin:admin -d '{"login":"test123", "password":"123456"}' "https://localhost/pulp/api/v2/users/"
HTTP/1.1 201 CREATED
Date: Fri, 26 Jun 2015 16:52:13 GMT
Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
Content-Length: 187
Location: https://localhost/pulp/api/v2/users/test123/
Content-Type: application/json
{"_id": {"$oid": "558d833ee512ed777daefd31"}, "name": "test123", "roles": [], "_ns": "users", "login": "test123", "id": "558d833ee512ed777daefd31", "_href": "/pulp/api/v2/users/test123/"}
User creation with a nonexisting parameter:
>> curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: webpy" -X POST -k -u admin:admin -d '{"invalid_parameter":"1234", "login":"user123", "password":"654321"}' "https://localhost/pulp/api/v2/users/"
HTTP/1.1 400 BAD REQUEST
Date: Fri, 26 Jun 2015 17:04:43 GMT
Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
Content-Encoding: utf-8
Content-Length: 422
Connection: close
Content-Type: application/json
{"http_request_method": "POST", "exception": null, "error_message": "Invalid properties: ['invalid_parameter']", "property_names": ["invalid_parameter"], "_href": "/pulp/api/v2/users/", "http_status": 400, "error": {"code": "PLP0015", "data": {"property_names": ["invalid_parameter"], "properties": "['invalid_parameter']"}, "description": "Invalid properties: ['invalid_parameter']", "sub_errors": []}, "traceback": null}
User update with not valid parameter:
curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: webpy" -X PUT -k -u admin:admin -d '{"delta":{"invalid": "1234"}}' "https://localhost/pulp/api/v2/users/barabashka/"
HTTP/1.1 400 BAD REQUEST
Date: Fri, 26 Jun 2015 18:51:55 GMT
Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
Content-Encoding: utf-8
Content-Length: 382
Connection: close
Content-Type: application/json
{"http_request_method": "PUT", "exception": null, "error_message": "Invalid properties: ['invalid']", "property_names": ["invalid"], "_href": "/pulp/api/v2/users/barabashka/", "http_status": 400, "error": {"code": "PLP0015", "data": {"property_names": ["invalid"], "properties": "['invalid']"}, "description": "Invalid properties: ['invalid']", "sub_errors": []}, "traceback": null}
Update of nonexisting user:
curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: webpy" -X PUT -k -u admin:admin -d '{"delta":{"invalid": "1234"}}' "https://localhost/pulp/api/v2/users/no_user/"
HTTP/1.1 404 NOT FOUND
Date: Fri, 26 Jun 2015 18:51:06 GMT
Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
Content-Encoding: utf-8
Content-Length: 388
Content-Type: application/json
{"http_request_method": "PUT", "exception": null, "error_message": "Missing resource(s): resource_id=no_user", "_href": "/pulp/api/v2/users/no_user/", "http_status": 404, "error": {"code": "PLP0009", "data": {"resources": {"resource_id": "no_user"}}, "description": "Missing resource(s): resource_id=no_user", "sub_errors": []}, "traceback": null, "resources": {"resource_id": "no_user"}}
Updated by amacdona@redhat.com almost 8 years ago
- Status changed from 6 to CLOSED - CURRENTRELEASE
Updated by bmbouter over 3 years ago
- Category deleted (
14)
We are removing the 'API' category per open floor discussion June 16, 2020.