Bug 1116825

Summary: Add non existent user to a role should return 400
Product: [Retired] Pulp Reporter: Ina Panova <ipanova>
Component: API/integrationAssignee: Jeremy Cline <jcline>
Status: CLOSED UPSTREAM QA Contact: Irina Gulina <igulina>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 2.4 BetaCC: igulina, jcline, skarmark
Target Milestone: ---Keywords: Triaged
Target Release: 2.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-28 22:12:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ina Panova 2014-07-07 12:01:13 UTC
Description of problem:
http://pulp-dev-guide.readthedocs.org/en/latest/integration/rest-api/role/cud.html#add-a-user-to-a-role

FAIL: test_08_add_unexistant_user (tests.test_06_roles.SimpleRoleTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/user/myprojects/pulp-automation/tests/test_06_roles.py", line 108, in test_08_add_unexistant_user
    self.assertPulp(code=400)
  File "/home/user/myprojects/pulp-automation/tests/pulp_test.py", line 57, in assertPulp
    code
  File "/home/ipanova/myprojects/pulp-automation/tests/pulp_test.py", line 66, in assertEqual
    super(PulpTest, self).assertEqual(a, b, pprint.pformat("%r != %r" % (a, b)))
AssertionError: '404 != 400'
-------------------- >> begin captured logging << --------------------
urllib3.connectionpool: DEBUG: "POST /pulp/api/v2/roles/SimpleRoleTest_role/users/ HTTP/1.1" 404 439
pulp_auto.pulp: DEBUG: <pulp_auto.pulp.Pulp object at 0x19dd4d0>.send(Request('POST', u'/roles/SimpleRoleTest_role/users/', data='{"login": "Unexistant_user"}', headers={'Content-Type': 'application/json'})) == <Response [404]>

Version-Release number of selected component (if applicable):
2.4.0-0.23.beta

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:
404 code is returned

Expected results:
400 code is returned

Additional info:

Comment 1 Jeremy Cline 2014-11-17 22:08:55 UTC
https://github.com/pulp/pulp/pull/1310

Comment 2 Chris Duryee 2014-12-23 20:52:18 UTC
fixed in pulp 2.6.0-0.2.beta

Comment 3 Irina Gulina 2014-12-26 02:36:31 UTC
rpm -qa | grep pulp-server
pulp-server-2.6.0-0.2.beta.el6.noarch

>> curl -i -H "Accept: application/json" -X POST -k -u admin:admin -d '{"login": "test-user"}' 'https://localhost/pulp/api/v2/roles/test-role/users/'
HTTP/1.1 200 OK
Date: Fri, 26 Dec 2014 02:31:11 GMT
Server: Apache/2.2.15 (Red Hat)
Content-Length: 4
Connection: close
Content-Type: application/json

>> curl -i -H "Accept: application/json" -X POST -k -u admin:admi '{"login": "genka"}' 'https://localhost/pulp/api/v2/roles/test-role/users/'

HTTP/1.1 400 Bad Request
Date: Fri, 26 Dec 2014 02:31:24 GMT
Server: Apache/2.2.15 (Red Hat)
Content-Encoding: utf-8
Content-Length: 378
Connection: close
Content-Type: application/json

{"http_request_method": "POST", "exception": null, "error_message": "Invalid properties: ['login']", "property_names": ["login"], "_href": "/pulp/api/v2/roles/test-role/users/", "http_status": 400, "error": {"code": "PLP0015", "data": {"property_names": ["login"], "properties": "['login']"}, "description": "Invalid properties: ['login']", "sub_errors": []}, "traceback": null}

Comment 4 Brian Bouterse 2015-02-28 22:12:24 UTC
Moved to https://pulp.plan.io/issues/468