Method: RHC::Rest::Mock::Helpers#stub_one_domain

Defined in:
lib/rhc/rest/mock.rb

#stub_one_domain(name, optional_params = nil, with_auth = mock_user_auth) ⇒ Object



205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/rhc/rest/mock.rb', line 205

def stub_one_domain(name, optional_params=nil, with_auth=mock_user_auth)
  stub_api_request(:get, 'broker/rest/domains', with_auth).
    to_return({
      :body => {
        :type => 'domains',
        :data => [{:id => name, :links => mock_response_links(mock_domain_links(name).concat([
          ['LIST_APPLICATIONS', "broker/rest/domains/#{name}/applications", 'get'],
          ['ADD_APPLICATION', "broker/rest/domains/#{name}/applications", 'post', ({:optional_params => optional_params} if optional_params)],
          (['LIST_MEMBERS', "broker/rest/domains/#{name}/members", 'get'] if example_allows_members?),
          (['UPDATE_MEMBERS', "broker/rest/domains/#{name}/members", 'patch'] if example_allows_members?),
        ].compact))}],
      }.to_json
    })
end