=begin #Dropbox Sign API #Dropbox Sign v3 API The version of the OpenAPI document: 3.0.0 Contact: apisupport@hellosign.com Generated by: https://openapi-generator.tech OpenAPI Generator version: 5.3.0 =end require 'spec_helper' require 'json_spec' require_relative '../test_utils' root_file_path = __dir__ + "/../../test_fixtures" describe Dropbox::Sign::TemplateApi do context 'TemplateApiTest' do api = Dropbox::Sign::TemplateApi.new it 'testTemplateAddUser' do template_id = 'f57db65d3f933b5316d398057a36176831451a35' request_class = 'TemplateAddUserRequest' request_data = get_fixture_data(request_class)[:default] response_class = 'TemplateGetResponse' response_data = get_fixture_data(response_class)[:default] set_expected_response(200, JSON.dump(response_data)) expected = Dropbox::Sign::TemplateGetResponse.init(response_data) obj = Dropbox::Sign::TemplateAddUserRequest.init(request_data) result = api.template_add_user(template_id, obj) expect(result.class.to_s).to eq("Dropbox::Sign::#{response_class}") expect(result.to_json).to be_json_eql(JSON.dump(expected)) end it 'testTemplateCreateEmbeddedDraft' do request_class = 'TemplateCreateEmbeddedDraftRequest' request_data = get_fixture_data(request_class)[:default] response_class = 'TemplateCreateEmbeddedDraftResponse' response_data = get_fixture_data(response_class)[:default] set_expected_response(200, JSON.dump(response_data)) expected = Dropbox::Sign::TemplateCreateEmbeddedDraftResponse.init(response_data) obj = Dropbox::Sign::TemplateCreateEmbeddedDraftRequest.init(request_data) obj.files = [File.new("#{root_file_path}/pdf-sample.pdf", "r")] result = api.template_create_embedded_draft(obj) expect(result.class.to_s).to eq("Dropbox::Sign::#{response_class}") expect(result.to_json).to be_json_eql(JSON.dump(expected)) end skip 'testTemplateDelete' do end it 'testTemplateFiles' do template_id = 'f57db65d3f933b5316d398057a36176831451a35' response_class = 'FileResponse' response_data = get_fixture_data(response_class)[:default] set_expected_response(200, JSON.dump(response_data)) expected = Dropbox::Sign::FileResponse.init(response_data) result = api.template_files_as_file_url(template_id, {}) expect(result.class.to_s).to eq("Dropbox::Sign::#{response_class}") expect(result.to_json).to be_json_eql(JSON.dump(expected)) end it 'testTemplateGet' do template_id = 'f57db65d3f933b5316d398057a36176831451a35' response_class = 'TemplateGetResponse' response_data = get_fixture_data(response_class)[:default] set_expected_response(200, JSON.dump(response_data)) expected = Dropbox::Sign::TemplateGetResponse.init(response_data) result = api.template_get(template_id) expect(result.class.to_s).to eq("Dropbox::Sign::#{response_class}") expect(result.to_json).to be_json_eql(JSON.dump(expected)) end it 'testTemplateList' do account_id = 'all' response_class = 'TemplateListResponse' response_data = get_fixture_data(response_class)[:default] set_expected_response(200, JSON.dump(response_data)) expected = Dropbox::Sign::TemplateListResponse.init(response_data) result = api.template_list({ :account_id => account_id }) expect(result.class.to_s).to eq("Dropbox::Sign::#{response_class}") expect(result.to_json).to be_json_eql(JSON.dump(expected)) end it 'testTemplateRemoveUser' do template_id = '21f920ec2b7f4b6bb64d3ed79f26303843046536' request_class = 'TemplateRemoveUserRequest' request_data = get_fixture_data(request_class)[:default] response_class = 'TemplateGetResponse' response_data = get_fixture_data(response_class)[:default] set_expected_response(200, JSON.dump(response_data)) expected = Dropbox::Sign::TemplateGetResponse.init(response_data) obj = Dropbox::Sign::TemplateRemoveUserRequest.init(request_data) result = api.template_remove_user(template_id, obj) expect(result.class.to_s).to eq("Dropbox::Sign::#{response_class}") expect(result.to_json).to be_json_eql(JSON.dump(expected)) end it 'testTemplateUpdateFiles' do template_id = '21f920ec2b7f4b6bb64d3ed79f26303843046536' request_class = 'TemplateUpdateFilesRequest' request_data = get_fixture_data(request_class)[:default] response_class = 'TemplateUpdateFilesResponse' response_data = get_fixture_data(response_class)[:default] set_expected_response(200, JSON.dump(response_data)) expected = Dropbox::Sign::TemplateUpdateFilesResponse.init(response_data) obj = Dropbox::Sign::TemplateUpdateFilesRequest.init(request_data) obj.files = [File.new("#{root_file_path}/pdf-sample.pdf", "r")] result = api.template_update_files(template_id, obj) expect(result.class.to_s).to eq("Dropbox::Sign::#{response_class}") expect(result.to_json).to be_json_eql(JSON.dump(expected)) end end end