Sha256: fdd3ea97fc60e1bddab1c080e6607b3322eecec1fdb6f8fd131c43cbdbe03308

Contents?: true

Size: 1.86 KB

Versions: 8

Compression:

Stored size: 1.86 KB

Contents

require File.join(File.dirname(__FILE__),'..','api_helper')

describe "RhoconnectApiGetClientParams" do
  it_should_behave_like "ApiHelper" do
    it "should list client attributes" do
      get "/rc/#{Rhoconnect::API_VERSION}/clients/#{@c.id}",  {}, {Rhoconnect::API_TOKEN_HEADER => @api_token}
      res = JSON.parse(last_response.body)
      res.delete_if { |attrib| attrib['name'] == 'rho__id' || attrib['name'] == 'last_sync'}
      res.sort{|x,y| x['name']<=>y['name']}.should == [
        {"name"=>"device_type", "value"=>"Apple", "type"=>"string"}, 
        {"name"=>"device_pin", "value"=>"abcd", "type"=>"string"}, 
        {"name"=>"device_port", "value"=>"3333", "type"=>"string"},
        {"name"=>"device_push_type", "type"=>"string", "value"=>nil},  
        {"name"=>"user_id", "value"=>"testuser", "type"=>"string"}, 
        {"name"=>"phone_id", "value"=>nil, "type"=>"string"},
        {"name"=>"app_id", "value"=>"application", "type"=>"string"}].sort{|x,y| x['name']<=>y['name']}
    end
    
    it "should list client attributes with old route and deprecation warning" do
      post "/api/get_client_params", {:api_token => @api_token, :client_id =>@c.id}
      res = JSON.parse(last_response.body)
      res.delete_if { |attrib| attrib['name'] == 'rho__id' || attrib['name'] == 'last_sync'}
      res.sort{|x,y| x['name']<=>y['name']}.should == [
        {"name"=>"device_type", "value"=>"Apple", "type"=>"string"}, 
        {"name"=>"device_pin", "value"=>"abcd", "type"=>"string"}, 
        {"name"=>"device_port", "value"=>"3333", "type"=>"string"},
        {"name"=>"device_push_type", "type"=>"string", "value"=>nil}, 
        {"name"=>"user_id", "value"=>"testuser", "type"=>"string"}, 
        {"name"=>"phone_id", "value"=>nil, "type"=>"string"},
        {"name"=>"app_id", "value"=>"application", "type"=>"string"}].sort{|x,y| x['name']<=>y['name']}
    end
  end  
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rhoconnect-4.0.4 spec/api/client/get_client_params_spec.rb
rhoconnect-4.0.3 spec/api/client/get_client_params_spec.rb
rhoconnect-4.0.2 spec/api/client/get_client_params_spec.rb
rhoconnect-4.0.1 spec/api/client/get_client_params_spec.rb
rhoconnect-4.0.0 spec/api/client/get_client_params_spec.rb
rhoconnect-4.0.0.beta.24 spec/api/client/get_client_params_spec.rb
rhoconnect-4.0.0.beta.10 spec/api/client/get_client_params_spec.rb
rhoconnect-4.0.0.beta.12 spec/api/client/get_client_params_spec.rb