Sha256: 04b4f97e6605d57de1949e6de6e6fa57bf21ff28f5ffad140ebcdd7fbed112a6
Contents?: true
Size: 1.24 KB
Versions: 7
Compression:
Stored size: 1.24 KB
Contents
# # To change this template, choose Tools | Templates # and open the template in the editor. $:.unshift File.join(File.dirname(__FILE__),'..','lib') require 'test/unit' require 'rhcp/response' class ResponseTest < Test::Unit::TestCase def test_simple response = RHCP::Response.new() assert_not_nil response response.mark_as_error("something went wrong") assert_equal "something went wrong", response.error_text assert_equal "", response.error_detail end def test_payload response = RHCP::Response.new() assert_not_nil response response.set_payload("some data") assert_equal "some data", response.data end def test_json response = RHCP::Response.new() response.set_payload("some data") response.mark_as_error("something went wrong", "things got really fucked up") json = response.to_json() assert_not_nil json r2 = RHCP::Response.reconstruct_from_json(json) #r2 = JSON.parse(json) assert_not_nil r2 assert_instance_of RHCP::Response, r2 assert_equal RHCP::Response::Status::ERROR, r2.status assert_equal "something went wrong", r2.error_text assert_equal "things got really fucked up", r2.error_detail assert_equal "some data", r2.data end end
Version data entries
7 entries across 7 versions & 1 rubygems