Sha256: 972287234ecae4bff2c4d65fd6257e87a63a720236e663ed4834bb522aa6f866
Contents?: true
Size: 1.46 KB
Versions: 13
Compression:
Stored size: 1.46 KB
Contents
require File.join(File.dirname(__FILE__),'..','api_helper') describe "RhoconnectApiClientGetDbDoc" do it_should_behave_like "ApiHelper" do it "should get clients's db document by doc key and data" do data = {'1' => {'foo' => 'bar'}} dockey = 'myclientdoc' post "/rc/#{Rhoconnect::API_VERSION}/clients/#{@c.id}/sources/#{@c.source_name}/docs/#{dockey}", {:data => data}, {Rhoconnect::API_TOKEN_HEADER => @api_token} last_response.should be_ok get "/rc/#{Rhoconnect::API_VERSION}/clients/#{@c.id}/sources/#{@c.source_name}/docs/#{dockey}", {}, {Rhoconnect::API_TOKEN_HEADER => @api_token} last_response.should be_ok JSON.parse(last_response.body).should == data end it "should append data to the client's db document by doc name and data" do data = {'1' => {'foo' => 'bar'}} data2 = {'2' => {'foo1' => 'bar1'}} data3 = data.merge(data2) dockey = 'abc:abc' cdocname = @c.docname(dockey) post "/rc/#{Rhoconnect::API_VERSION}/clients/#{@c.id}/sources/#{@c.source_name}/docs/#{dockey}", {:data => data}, {Rhoconnect::API_TOKEN_HEADER => @api_token} last_response.should be_ok verify_result(cdocname => data) post "/rc/#{Rhoconnect::API_VERSION}/clients/#{@c.id}/sources/#{@c.source_name}/docs/#{dockey}", {:data => data2, :append => true}, {Rhoconnect::API_TOKEN_HEADER => @api_token} last_response.should be_ok verify_result(cdocname => data3) end end end
Version data entries
13 entries across 13 versions & 1 rubygems