Description of problem: A spin on Bug 729070 is that when adding the pool to the activation key, there should be some error checking on the quantity... For example: check that the quantity is positive>0 check that the quantity is <= the total quantity in the pool Version-Release number of selected component (if applicable): [root@jsefler-onprem-62candlepin proxy]# git show-ref | grep master 895fdff46e33a607d63350df9bdd7bdd275b9e17 refs/heads/master 895fdff46e33a607d63350df9bdd7bdd275b9e17 refs/remotes/origin/master How reproducible: Steps to Reproduce: Here's an example of an activation key for which pools were added with quantities that should not have been accepted.... [jsefler@jsefler ~]$ curl -k --request GET --user testuser1:password https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/activation_keys/8a90f8c631aa31920131aa37efdc06fa | python -mjson.tool % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 102 1736 102 1736 0 0 4485 0 --:--:-- --:--:-- --:--:-- 15639 { "created": "2011-08-08T16:26:57.884+0000", "id": "8a90f8c631aa31920131aa37efdc06fa", "name": "ActivationKeyForPool8a90f8c631aa31920131aa3309a20267", "owner": { "displayName": "Admin Owner", "href": "/owners/admin", "id": "8a90f8c631aa31920131aa3205690006", "key": "admin" }, "pools": [ { "created": "2011-08-08T18:55:40.208+0000", "id": "8a90f8c631aa31920131aac014b00792", "pool": { "href": "/pools/8a90f8c631aa31920131aa33222606b6", "id": "8a90f8c631aa31920131aa33222606b6" }, "quantity": 1234567890, "updated": "2011-08-08T18:55:40.208+0000" }, { "created": "2011-08-08T18:55:01.317+0000", "id": "8a90f8c631aa31920131aabf7cc50791", "pool": { "href": "/pools/8a90f8c631aa31920131aa3321f006a5", "id": "8a90f8c631aa31920131aa3321f006a5" }, "quantity": -999, "updated": "2011-08-08T18:55:01.317+0000" }, { "created": "2011-08-08T18:10:48.511+0000", "id": "8a90f8c631aa31920131aa97023f0784", "pool": { "href": "/pools/8a90f8c631aa31920131aa33231306d7", "id": "8a90f8c631aa31920131aa33231306d7" }, "quantity": -1, "updated": "2011-08-08T18:10:48.511+0000" }, { "created": "2011-08-08T18:12:56.330+0000", "id": "8a90f8c631aa31920131aa98f58a0785", "pool": { "href": "/pools/8a90f8c631aa31920131aa3322d406cf", "id": "8a90f8c631aa31920131aa3322d406cf" }, "quantity": 0, "updated": "2011-08-08T18:12:56.330+0000" } ], "updated": "2011-08-08T16:26:57.884+0000" } Actual results: Expected results: Additional info:
Verifying Version... [root@jsefler-onprem-62candlepin proxy]# git branch 0.3 * master [root@jsefler-onprem-62candlepin proxy]# git show-ref | grep master 517e1deb46bc6365da35ff12944815208eedb9d6 refs/heads/master 517e1deb46bc6365da35ff12944815208eedb9d6 refs/remotes/origin/master [jsefler@jseflerT510 ~]$ curl -k --user testuser1:password --request POST https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/activation_keys/8a90f8c6320db34301320e52ff5d64c0/pools/8a90f8c6320db34301320db4be0a04dd?quantity=1234567890 | python -mjson.tool % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 89 100 89 0 0 171 0 --:--:-- --:--:-- --:--:-- 225 { "displayMessage": "The quantity must not be greater than the total allowed for the pool" } [jsefler@jseflerT510 ~]$ curl -k --user testuser1:password --request POST https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/activation_keys/8a90f8c6320db34301320e52ff5d64c0/pools/8a90f8c6320db34301320db4be0a04dd?quantity=-999 | python -mjson.tool % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 56 100 56 0 0 119 0 --:--:-- --:--:-- --:--:-- 157 { "displayMessage": "The quantity must be greater than 0" } [jsefler@jseflerT510 ~]$ curl -k --user testuser1:password --request POST https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/activation_keys/8a90f8c6320db34301320e52ff5d64c0/pools/8a90f8c6320db34301320db4be0a04dd?quantity=-1 | python -mjson.tool % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 56 100 56 0 0 123 0 --:--:-- --:--:-- --:--:-- 162 { "displayMessage": "The quantity must be greater than 0" } [jsefler@jseflerT510 ~]$ curl -k --user testuser1:password --request POST https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/activation_keys/8a90f8c6320db34301320e52ff5d64c0/pools/8a90f8c6320db34301320db4be0a04dd?quantity=0 | python -mjson.tool % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 56 100 56 0 0 117 0 --:--:-- --:--:-- --:--:-- 153 { "displayMessage": "The quantity must be greater than 0" } Moving to VERIFIED