Bug #17262

BmcApiTest.test_api_can_pass_empty_body_and_get_415_error fails with a 400 response code

Added by Dominic Cleal about 1 year ago. Updated about 1 year ago.

Status:Closed
Priority:High
Assigned To:Dominic Cleal
Category:Tests
Target version:-
Difficulty: Bugzilla link:
Found in release: Pull request:https://github.com/theforeman/smart-proxy/pull/473
Story points-
Velocity based estimate-
Release1.13.2Release relationshipAuto

Description

The following test has started failing:

BmcApiTest.test_api_can_pass_empty_body_and_get_415_error
<400> expected but was
<415>. (Test::Unit::AssertionFailedError)
/var/lib/workspace/workspace/test_proxy_1_13_stable/puppet/4.2.0/ruby/2.2/test/bmc/bmc_api_test.rb:370:in `test_api_can_pass_empty_body_and_get_415_error'    

The API is responding with a 400 response code (note the expected/actual values are the wrong way around).

Associated revisions

Revision c896ba33
Added by Dominic Cleal about 1 year ago

fixes #17262 - verify the JSON request body contains a hash

The json 2.x gem now parses strings and other non-hash root nodes, so
the data type need to be checked when parsing JSON bodies.

History

#1 Updated by Dominic Cleal about 1 year ago

  • Status changed from New to Assigned
  • Assigned To set to Dominic Cleal

#2 Updated by Dominic Cleal about 1 year ago

rdoc was updated from 4.2.2 to 4.3.0 and now permits the json 2.x gem series from 1.8.x. This now allows for an empty JSON string to be parsed ("") which was an expected failure in this test. The string is now parsed and parse_json_body (in the smart proxy helpers) returns an empty string to the BMC API, which tries to call #merge on it - not valid for a string.

#3 Updated by The Foreman Bot about 1 year ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/smart-proxy/pull/473 added

#4 Updated by Dominic Cleal about 1 year ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF