Sha256: a0f28390935fd6b9bda90067c1053fa746aa7b1455160c4ba7277e647addd1c5

Contents?: true

Size: 1.37 KB

Versions: 5

Compression:

Stored size: 1.37 KB

Contents

require 'spec_helper'
require 'standard_methods_helper'

describe Conjur::API, api: :dummy do
  describe '#create_user' do
    it_should_behave_like 'standard_create with', :user, nil, login: 'login', other: true do
      let(:invoke) { api.create_user 'login', other: true }
    end
  end

  describe 'user#update' do
    let(:userid) { "alice@wonderland" }
    it "PUTs to /users/:id?uidnumber=:uidnumber" do
      expect_request(
        method: :put,
        url: "#{core_host}/users/#{api.fully_escape(userid)}",
        headers: credentials[:headers],
        payload: { uidnumber: 12345 }
       )
      api.user(userid).update(uidnumber: 12345)
    end
    
  end

  describe "find_users" do

    let(:search_parameters) { {uidnumber: 12345} }
    let(:search_result)     { ["someuser"].to_json }
    
    it "GETs /users/search with appropriate options, and returns parsed JSON response" do
      expect_request(
        method: :get,  
        url: "#{core_host}/users/search?uidnumber=12345",
        headers: credentials[:headers]
      ).and_return search_result

      parsed = double()

      expect(JSON).to receive(:parse).with(search_result).and_return(parsed)

      expect(api.find_users(search_parameters)).to eq(parsed)
    end
  end

  describe '#user' do
    it_should_behave_like 'standard_show with', :user, :login do
      let(:invoke) { api.user :login }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
conjur-api-4.19.1 spec/api/users_spec.rb
conjur-api-4.19.0 spec/api/users_spec.rb
conjur-api-4.16.0 spec/api/users_spec.rb
conjur-api-4.15.0 spec/api/users_spec.rb
conjur-api-4.14.0 spec/api/users_spec.rb