Update ruby httpx petstore test (#16753)

* update ruby httpx petstore test

* fix pom

* comment out ruby httpx tests
This commit is contained in:
William Cheng
2023-10-09 15:43:21 +08:00
committed by GitHub
parent e3db882ed4
commit 23c5db602f
109 changed files with 5060 additions and 655 deletions

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -34,7 +34,7 @@ describe 'DefaultApi' do
# unit tests for foo_get
# @param [Hash] opts the optional parameters
# @return [FooGetDefaultResponse]
# @return [InlineResponseDefault]
describe 'foo_get test' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -32,16 +32,6 @@ describe 'FakeApi' do
end
end
# unit tests for fake_big_decimal_map
# for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys
# @param [Hash] opts the optional parameters
# @return [FakeBigDecimalMap200Response]
describe 'fake_big_decimal_map test' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
end
end
# unit tests for fake_health_get
# Health check endpoint
# @param [Hash] opts the optional parameters
@@ -109,31 +99,9 @@ describe 'FakeApi' do
end
end
# unit tests for fake_property_enum_integer_serialize
# Test serialization of enum (int) properties with examples
# @param outer_object_with_enum_property Input enum (int) as post body
# @param [Hash] opts the optional parameters
# @return [OuterObjectWithEnumProperty]
describe 'fake_property_enum_integer_serialize test' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
end
end
# unit tests for test_body_with_binary
# For this test, the body has to be a binary file.
# @param body image to upload
# @param [Hash] opts the optional parameters
# @return [nil]
describe 'test_body_with_binary test' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
end
end
# unit tests for test_body_with_file_schema
# For this test, the body for this request must reference a schema named `File`.
# @param file_schema_test_class
# For this test, the body for this request much reference a schema named `File`.
# @param file_schema_test_class
# @param [Hash] opts the optional parameters
# @return [nil]
describe 'test_body_with_file_schema test' do
@@ -143,8 +111,8 @@ describe 'FakeApi' do
end
# unit tests for test_body_with_query_params
# @param query
# @param user
# @param query
# @param user
# @param [Hash] opts the optional parameters
# @return [nil]
describe 'test_body_with_query_params test' do
@@ -166,8 +134,8 @@ describe 'FakeApi' do
end
# unit tests for test_endpoint_parameters
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
# @param number None
# @param double None
# @param pattern_without_delimiter None
@@ -180,7 +148,7 @@ describe 'FakeApi' do
# @option opts [String] :string None
# @option opts [File] :binary None
# @option opts [Date] :date None
# @option opts [Time] :date_time None
# @option opts [DateTime] :date_time None
# @option opts [String] :password None
# @option opts [String] :callback None
# @return [nil]
@@ -200,7 +168,6 @@ describe 'FakeApi' do
# @option opts [String] :enum_query_string Query parameter enum test (string)
# @option opts [Integer] :enum_query_integer Query parameter enum test (double)
# @option opts [Float] :enum_query_double Query parameter enum test (double)
# @option opts [Array<EnumClass>] :enum_query_model_array
# @option opts [Array<String>] :enum_form_string_array Form parameter enum test (string array)
# @option opts [String] :enum_form_string Form parameter enum test (string)
# @return [nil]
@@ -229,7 +196,6 @@ describe 'FakeApi' do
# unit tests for test_inline_additional_properties
# test inline additionalProperties
#
# @param request_body request body
# @param [Hash] opts the optional parameters
# @return [nil]
@@ -239,21 +205,8 @@ describe 'FakeApi' do
end
end
# unit tests for test_inline_freeform_additional_properties
# test inline free-form additionalProperties
#
# @param test_inline_freeform_additional_properties_request request body
# @param [Hash] opts the optional parameters
# @return [nil]
describe 'test_inline_freeform_additional_properties test' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
end
end
# unit tests for test_json_form_data
# test json serialization of form data
#
# @param param field1
# @param param2 field2
# @param [Hash] opts the optional parameters
@@ -264,28 +217,14 @@ describe 'FakeApi' do
end
end
# unit tests for test_nullable
# test nullable parent property
#
# @param child_with_nullable request body
# @param [Hash] opts the optional parameters
# @return [nil]
describe 'test_nullable test' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
end
end
# unit tests for test_query_parameter_collection_format
# To test the collection format in query parameters
# @param pipe
# @param ioutil
# @param http
# @param url
# @param context
# @param allow_empty
# @param pipe
# @param ioutil
# @param http
# @param url
# @param context
# @param [Hash] opts the optional parameters
# @option opts [Hash<String, String>] :language
# @return [nil]
describe 'test_query_parameter_collection_format test' do
it 'should work' do

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -34,7 +34,6 @@ describe 'PetApi' do
# unit tests for add_pet
# Add a new pet to the store
#
# @param pet Pet object that needs to be added to the store
# @param [Hash] opts the optional parameters
# @return [nil]
@@ -46,10 +45,9 @@ describe 'PetApi' do
# unit tests for delete_pet
# Deletes a pet
#
# @param pet_id Pet id to delete
# @param [Hash] opts the optional parameters
# @option opts [String] :api_key
# @option opts [String] :api_key
# @return [nil]
describe 'delete_pet test' do
it 'should work' do
@@ -95,7 +93,6 @@ describe 'PetApi' do
# unit tests for update_pet
# Update an existing pet
#
# @param pet Pet object that needs to be added to the store
# @param [Hash] opts the optional parameters
# @return [nil]
@@ -107,7 +104,6 @@ describe 'PetApi' do
# unit tests for update_pet_with_form
# Updates a pet in the store with form data
#
# @param pet_id ID of pet that needs to be updated
# @param [Hash] opts the optional parameters
# @option opts [String] :name Updated name of the pet
@@ -121,7 +117,6 @@ describe 'PetApi' do
# unit tests for upload_file
# uploads an image
#
# @param pet_id ID of pet to update
# @param [Hash] opts the optional parameters
# @option opts [String] :additional_metadata Additional data to pass to server
@@ -135,7 +130,6 @@ describe 'PetApi' do
# unit tests for upload_file_with_required_file
# uploads an image (required)
#
# @param pet_id ID of pet to update
# @param required_file file to upload
# @param [Hash] opts the optional parameters

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -69,7 +69,6 @@ describe 'StoreApi' do
# unit tests for place_order
# Place an order for a pet
#
# @param order order placed for purchasing the pet
# @param [Hash] opts the optional parameters
# @return [Order]

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -46,7 +46,6 @@ describe 'UserApi' do
# unit tests for create_users_with_array_input
# Creates list of users with given input array
#
# @param user List of user object
# @param [Hash] opts the optional parameters
# @return [nil]
@@ -58,7 +57,6 @@ describe 'UserApi' do
# unit tests for create_users_with_list_input
# Creates list of users with given input array
#
# @param user List of user object
# @param [Hash] opts the optional parameters
# @return [nil]
@@ -82,7 +80,6 @@ describe 'UserApi' do
# unit tests for get_user_by_name
# Get user by user name
#
# @param username The name that needs to be fetched. Use user1 for testing.
# @param [Hash] opts the optional parameters
# @return [User]
@@ -94,7 +91,6 @@ describe 'UserApi' do
# unit tests for login_user
# Logs user into the system
#
# @param username The user name for login
# @param password The password for login in clear text
# @param [Hash] opts the optional parameters
@@ -107,7 +103,6 @@ describe 'UserApi' do
# unit tests for logout_user
# Logs out current logged in user session
#
# @param [Hash] opts the optional parameters
# @return [nil]
describe 'logout_user test' do

View File

@@ -0,0 +1,20 @@
require 'spec_helper'
describe Petstore::ApiClient do
describe '#initialize' do
it "should save the message if one is given" do
err = Petstore::ApiError.new(message: "Hello")
expect(err.message).to eq("Hello")
end
it "should save the message and code if both are given" do
err = Petstore::ApiError.new(message: "Hello", code: 0)
expect(err.message).to eq("Hello\nHTTP status code: 0")
end
it "should save the hash as message if no message is given" do
err = Petstore::ApiError.new(code: 500, response_body: "server error")
expect(err.message).to eq("Error message: the server returns an error\nHTTP status code: 500\nResponse body: server error")
end
end
end

View File

@@ -0,0 +1,169 @@
require 'spec_helper'
class ArrayMapObject < Petstore::Category
attr_accessor :int_arr, :pet_arr, :int_map, :pet_map, :int_arr_map, :pet_arr_map, :boolean_true_arr, :boolean_false_arr
def self.attribute_map
{
:int_arr => :int_arr,
:pet_arr => :pet_arr,
:int_map => :int_map,
:pet_map => :pet_map,
:int_arr_map => :int_arr_map,
:pet_arr_map => :pet_arr_map,
:boolean_true_arr => :boolean_true_arr,
:boolean_false_arr => :boolean_false_arr,
}
end
def self.openapi_types
{
:int_arr => :'Array<Integer>',
:pet_arr => :'Array<Pet>',
:int_map => :'Hash<String, Integer>',
:pet_map => :'Hash<String, Pet>',
:int_arr_map => :'Hash<String, Array<Integer>>',
:pet_arr_map => :'Hash<String, Array<Pet>>',
:boolean_true_arr => :'Array<Boolean>',
:boolean_false_arr => :'Array<Boolean>',
}
end
def initialize(attributes = {})
if (!attributes.is_a?(Hash))
fail ArgumentError, "The input argument (attributes) must be a hash in `ArrayMapObject` initialize method"
end
# check to see if the attribute exists and convert string to symbol for hash key
attributes = attributes.each_with_object({}) { |(k, v), h|
if (!self.class.attribute_map.key?(k.to_sym))
fail ArgumentError, "`#{k}` is not a valid attribute in `ArrayMapObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
end
h[k.to_sym] = v
}
if attributes.key?(:'int_arr')
if (value = attributes[:'int_arr']).is_a?(Array)
self.int_arr = value
end
end
if attributes.key?(:'pet_arr')
if (value = attributes[:'pet_arr']).is_a?(Array)
self.pet_arr = value
end
end
if attributes.key?(:'int_map')
if (value = attributes[:'int_map']).is_a?(Hash)
self.int_map = value
end
end
if attributes.key?(:'pet_map')
if (value = attributes[:'pet_map']).is_a?(Hash)
self.pet_map = value
end
end
if attributes.key?(:'int_arr_map')
if (value = attributes[:'int_arr_map']).is_a?(Hash)
self.int_arr_map = value
end
end
if attributes.key?(:'pet_arr_map')
if (value = attributes[:'pet_arr_map']).is_a?(Hash)
self.pet_arr_map = value
end
end
if attributes.key?(:'boolean_true_arr')
if (value = attributes[:'boolean_true_arr']).is_a?(Array)
self.boolean_true_arr = value
end
end
if attributes.key?(:'boolean_false_arr')
if (value = attributes[:'boolean_false_arr']).is_a?(Array)
self.boolean_false_arr = value
end
end
end
end
describe 'BaseObject' do
describe 'boolean values' do
let(:obj) { Petstore::Cat.new(declawed: false) }
it 'should have values set' do
expect(obj.declawed).not_to be_nil
expect(obj.declawed).to eq(false)
end
end
describe 'array and map properties' do
let(:data) do
{ int_arr: [123, 456],
pet_arr: [{ name: 'Kitty', photoUrls: ['www.photo-url.test'] }],
int_map: { 'int' => 123 },
pet_map: { 'pet' => { name: 'Kitty', photoUrls: ['www.photo-url.test'] } },
int_arr_map: { 'int_arr' => [123, 456] },
pet_arr_map: { 'pet_arr' => [{ name: 'Kitty', photoUrls: ['www.photo-url.test'] }] },
boolean_true_arr: [true, "true", "TruE", 1, "y", "yes", "1", "t", "T"],
boolean_false_arr: [false, "", 0, "0", "f", nil, "null", "\ntrue\n"],
}
end
it 'works for #build_from_hash' do
obj = ArrayMapObject.build_from_hash(data)
expect(obj.int_arr).to match_array([123, 456])
expect(obj.pet_arr).to be_instance_of(Array)
expect(obj.pet_arr.size).to eq(1)
pet = obj.pet_arr.first
expect(pet).to be_instance_of(Petstore::Pet)
expect(pet.name).to eq('Kitty')
expect(obj.int_map).to be_instance_of(Hash)
expect(obj.int_map).to eq('int' => 123)
expect(obj.pet_map).to be_instance_of(Hash)
pet = obj.pet_map['pet']
expect(pet).to be_instance_of(Petstore::Pet)
expect(pet.name).to eq('Kitty')
expect(obj.int_arr_map).to be_instance_of(Hash)
arr = obj.int_arr_map['int_arr']
expect(arr).to match_array([123, 456])
expect(obj.pet_arr_map).to be_instance_of(Hash)
arr = obj.pet_arr_map['pet_arr']
expect(arr).to be_instance_of(Array)
expect(arr.size).to eq(1)
pet = arr.first
expect(pet).to be_instance_of(Petstore::Pet)
expect(pet.name).to eq('Kitty')
expect(obj.boolean_true_arr).to be_instance_of(Array)
obj.boolean_true_arr.each do |b|
expect(b).to eq(true)
end
expect(obj.boolean_false_arr).to be_instance_of(Array)
obj.boolean_false_arr.each do |b|
expect(b).to eq(false)
end
end
it 'works for #to_hash' do
obj = ArrayMapObject.build_from_hash(data)
expect_data = data.dup
expect_data[:boolean_true_arr].map! { true }
expect_data[:boolean_false_arr].map! { false }
expect(obj.to_hash).to eq(expect_data)
end
end
end

View File

@@ -0,0 +1,75 @@
=begin
#OpenAPI Petstore
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.0.0-SNAPSHOT
=end
require 'spec_helper'
describe Petstore::Configuration do
let(:config) { Petstore::Configuration.new }
before(:each) do
# uncomment below to setup host and base_path
# require 'URI'
# uri = URI.parse("http://petstore.swagger.io:80/v2")
# Petstore.configure do |c|
# c.host = uri.host
# c.base_path = uri.path
# end
end
describe '#base_url' do
it 'should have the default value' do
expect(config.base_url).to eq("http://petstore.swagger.io/v2")
end
it 'returns default value when invalid operation is passed' do
expect(config.base_url('invalid_operation')).to eq('http://petstore.swagger.io/v2')
end
it 'returns proper URL default server_index' do
expect(config.base_url(:'PetApi.add_pet')).to eq('http://petstore.swagger.io/v2')
end
it 'returns proper URL when server_index is set' do
config.server_index = 1
expect(config.base_url(:'PetApi.add_pet')).to eq('http://path-server-test.petstore.local/v2')
end
it 'returns proper URL when server_operation_index is set' do
config.server_operation_index = {
:'PetApi.add_pet' => 1
}
expect(config.base_url(:'PetApi.add_pet')).to eq('http://path-server-test.petstore.local/v2')
end
it 'returns proper URL from server_settings when server_index is set' do
config.server_index = 1
expect(config.base_url).to eq('https://localhost:8080/v2')
end
it 'throws argument error when attempting to use a server index that is out of bounds' do
config.server_operation_index = {
:'PetApi.add_pet' => 10
}
expect {
config.base_url(:'PetApi.add_pet')
}.to raise_error(ArgumentError, 'Invalid index 10 when selecting the server. Must not be nil and must be less than 4')
end
it 'should remove trailing slashes' do
[nil, '', '/', '//'].each do |base_path|
config.base_path = base_path
# uncomment below to test trailing slashes
# expect(config.base_url).to eq("http://petstore.swagger.io:80/v2")
end
end
end
end

View File

@@ -0,0 +1,73 @@
require 'petstore_helper'
require 'spec_helper'
require 'json'
describe "Mammal" do
before do
end
after do
end
describe "anyOf" do
it "should construct a new anyOf object mammal_anyof" do
whale = Petstore::Whale.new('classname' => "Whale", 'has_teeth' => true)
zebra = Petstore::Zebra.new('classname' => "Zebra", 'type' => 'plains')
# oneOf whale test
expect(whale.to_hash[:'classname']).to eq("Whale")
result = Petstore::MammalAnyof.build(whale.to_hash)
expect(result).to be_a Petstore::Whale
# oneOf zebra test
expect(zebra.to_hash[:'classname']).to eq("Zebra")
result2 = Petstore::MammalAnyof.build(zebra.to_hash)
expect(result2).to be_a Petstore::Zebra
# invalid data/hash should result in nil
result3 = Petstore::MammalAnyof.build({"something": 123})
expect(result3).to be_nil
end
end
describe "oneOf" do
it "should construct a new oneOf object mammal" do
whale = Petstore::Whale.new('classname' => "Whale", 'has_teeth' => true)
zebra = Petstore::Zebra.new('classname' => "Zebra", 'type' => 'plains')
# oneOf whale test
expect(whale.to_hash[:'classname']).to eq("Whale")
result = Petstore::Mammal.build(whale.to_hash)
expect(result).to be_a Petstore::Whale
# oneOf zebra test
expect(zebra.to_hash[:'classname']).to eq("Zebra")
result2 = Petstore::Mammal.build(zebra.to_hash)
expect(result2).to be_a Petstore::Zebra
# invalid data/hash should result in nil
result3 = Petstore::Mammal.build({"something": 123})
expect(result3).to be_nil
end
it "should construct a new oneOf object mammal_without_discriminator" do
whale = Petstore::Whale.new('classname' => "Whale", 'has_teeth' => true)
zebra = Petstore::Zebra.new('classname' => "Zebra", 'type' => 'plains')
# oneOf whale test
expect(whale.to_hash[:'classname']).to eq("Whale")
result = Petstore::MammalWithoutDiscriminator.build(whale.to_hash)
expect(result).to be_a Petstore::Whale
# oneOf zebra test
expect(zebra.to_hash[:'classname']).to eq("Zebra")
result2 = Petstore::MammalWithoutDiscriminator.build(zebra.to_hash)
expect(result2).to be_a Petstore::Zebra
# invalid data/hash should result in nil
result3 = Petstore::MammalWithoutDiscriminator.build({"something": 123})
expect(result3).to be_nil
end
end
end

View File

@@ -0,0 +1,266 @@
require 'petstore_helper'
require 'spec_helper'
require 'json'
describe "Pet" do
before do
@pet_api = Petstore::PetApi.new(API_CLIENT)
@pet_id = prepare_pet(@pet_api)
end
after do
# remove the testing pet
begin
@pet_api.delete_pet(@pet_id)
rescue Petstore::ApiError => e
# ignore ApiError 404 (Not Found)
raise e if e.code != 404
end
end
describe "pet methods" do
it "should construct a new pet object" do
tag1 = Petstore::Tag.new('id' => 1, 'name' => 'tag1')
tag2 = Petstore::Tag.new('id' => 2, 'name' => 'tag2')
category1 = Petstore::Category.new(:id => 1, :name => 'category unknown')
# initialize using both string and symbol key
pet_hash = {
:id => @pet_id,
:name => "RUBY UNIT TESTING",
:status => "pending",
:photo_urls => ["url1", "url2"],
:category => category1,
:tags => [tag1, tag2]
}
pet = Petstore::Pet.new(pet_hash)
# test new
expect(pet.name).to eq("RUBY UNIT TESTING")
expect(pet.status).to eq("pending")
expect(pet.id).to eq(@pet_id)
expect(pet.tags[0].id).to eq(1)
expect(pet.tags[1].name).to eq('tag2')
expect(pet.category.name).to eq('category unknown')
# test build_from_hash
pet2 = Petstore::Pet.build_from_hash(pet.to_hash)
expect(pet.to_hash).to eq(pet2.to_hash)
# make sure sub-object has different object id
expect(pet.tags[0].object_id).not_to eq(pet2.tags[0].object_id)
expect(pet.tags[1].object_id).not_to eq(pet2.tags[1].object_id)
expect(pet.category.object_id).not_to eq(pet2.category.object_id)
end
it "should fetch a pet object" do
pet = @pet_api.get_pet_by_id(@pet_id)
expect(pet).to be_a(Petstore::Pet)
expect(pet.id).to eq(@pet_id)
expect(pet.name).to eq("RUBY UNIT TESTING")
expect(pet.tags[0].name).to eq("tag test")
expect(pet.category.name).to eq("category test")
end
it "should fetch a pet object using invalid operation path" do
# backup index
index_backup = @pet_api.api_client.config.server_operation_index
expect(index_backup).to eq({})
# test operation index 1 (invalid path)
@pet_api.api_client.config.server_operation_index = {
:'PetApi.get_pet_by_id' => 1
}
expect(@pet_api.api_client.config.base_url(:'PetApi.get_pet_by_id')).to eq('http://path-server-test.petstore.local/v2')
expect {
pet = @pet_api.get_pet_by_id(@pet_id)
}.to raise_error(Petstore::ApiError) # path-server-test.petstore.local is invalid (not defined in host table)
# restore index
@pet_api.api_client.config.server_operation_index = index_backup
expect(@pet_api.api_client.config.server_operation_index).to eq({})
end
it "should fetch a pet object using operation path" do
# backup index
index_backup = @pet_api.api_client.config.server_operation_index
expect(index_backup).to eq({})
# test operation index 3
@pet_api.api_client.config.server_operation_index = {
:'PetApi.get_pet_by_id' => 3
}
expect(@pet_api.api_client.config.base_url(:'PetApi.get_pet_by_id')).to eq('http://path.v2.test.openapi-generator.tech/v2')
pet = @pet_api.get_pet_by_id(@pet_id)
expect(pet).to be_a(Petstore::Pet)
expect(pet.id).to eq(@pet_id)
expect(pet.name).to eq("RUBY UNIT TESTING")
expect(pet.tags[0].name).to eq("tag test")
expect(pet.category.name).to eq("category test")
# restore index
@pet_api.api_client.config.server_operation_index = index_backup
expect(@pet_api.api_client.config.server_operation_index).to eq({})
expect(@pet_api.api_client.config.base_url(:'PetApi.get_pet_by_id')).to eq('http://petstore.swagger.io/v2')
end
it "should fetch a pet object with http info" do
pet, status_code, headers = @pet_api.get_pet_by_id_with_http_info(@pet_id)
expect(status_code).to eq(200)
expect(headers['Content-Type']).to eq('application/json')
expect(pet).to be_a(Petstore::Pet)
expect(pet.id).to eq(@pet_id)
expect(pet.name).to eq("RUBY UNIT TESTING")
expect(pet.tags[0].name).to eq("tag test")
expect(pet.category.name).to eq("category test")
end
it "should not find a pet that does not exist" do
begin
@pet_api.get_pet_by_id(-@pet_id)
fail 'it should raise error'
rescue Petstore::ApiError => e
expect(e.code).to eq(404)
# skip the check as the response contains a timestamp that changes on every response
# expect(e.message).to eq("Error message: the server returns an error\nHTTP status code: 404\nResponse headers: {\"Date\"=>\"Tue, 26 Feb 2019 04:35:40 GMT\", \"Access-Control-Allow-Origin\"=>\"*\", \"Access-Control-Allow-Methods\"=>\"GET, POST, DELETE, PUT\", \"Access-Control-Allow-Headers\"=>\"Content-Type, api_key, Authorization\", \"Content-Type\"=>\"application/json\", \"Connection\"=>\"close\", \"Server\"=>\"Jetty(9.2.9.v20150224)\"}\nResponse body: {\"code\":1,\"type\":\"error\",\"message\":\"Pet not found\"}")
expect(e.response_body).to eq('{"code":1,"type":"error","message":"Pet not found"}')
expect(e.response_headers).to include('Content-Type')
expect(e.response_headers['Content-Type']).to eq('application/json')
end
end
# skip the following as original petstore spec does not have endpoints for testing byte array
# we will re-enable this after updating the petstore server
xit "should create and get pet with byte array (binary, string)" do
pet = @pet_api.get_pet_by_id(@pet_id)
pet.id = @pet_id + 1
str = serialize_json(pet)
@pet_api.add_pet_using_byte_array(body: str)
fetched_str = @pet_api.pet_pet_idtesting_byte_arraytrue_get(pet.id)
expect(fetched_str).to be_a(String)
fetched = deserialize_json(fetched_str, 'Pet')
expect(fetched).to be_a(Petstore::Pet)
expect(fetched.id).to eq(pet.id)
expect(fetched.category).to be_a(Petstore::Category)
expect(fetched.category.name).to eq(pet.category.name)
@pet_api.delete_pet(pet.id)
end
# skip the following as original petstore spec does not have endpoints for testing byte array
# we will re-enable this after updating the petstore server
xit "should get pet in object" do
pet = @pet_api.get_pet_by_id_in_object(@pet_id)
expect(pet).to be_a(Petstore::InlineResponse200)
expect(pet.id).to eq(@pet_id)
expect(pet.name).to eq("RUBY UNIT TESTING")
expect(pet.category).to be_a(Hash)
expect(pet.category[:id]).to eq(20002)
expect(pet.category[:name]).to eq('category test')
end
it "should update a pet" do
pet = @pet_api.get_pet_by_id(@pet_id)
expect(pet.id).to eq(@pet_id)
expect(pet.name).to eq("RUBY UNIT TESTING")
expect(pet.status).to eq('pending')
@pet_api.update_pet_with_form(@pet_id, name: 'new name', status: 'sold')
fetched = @pet_api.get_pet_by_id(@pet_id)
expect(fetched.id).to eq(@pet_id)
expect(fetched.name).to eq("new name")
expect(fetched.status).to eq('sold')
end
it "should find pets by status" do
pets = @pet_api.find_pets_by_status(['available'])
expect(pets.length).to be >= 3
pets.each do |pet|
expect(pet).to be_a(Petstore::Pet)
expect(pet.status).to eq('available')
end
end
it "should not find a pet with invalid status" do
pets = @pet_api.find_pets_by_status(['invalid-status'])
expect(pets.length).to eq(0)
end
it "should find a pet by status" do
pets = @pet_api.find_pets_by_status(["available", "sold"])
pets.each do |pet|
if pet.status != 'available' && pet.status != 'sold'
raise "pet status wasn't right"
end
end
end
it "should create a pet" do
id = @pet_id + 1
pet = Petstore::Pet.new('id' => id, 'name' => "RUBY UNIT TESTING", 'photo_urls' => ['www.photo-url.test'])
result = @pet_api.add_pet(pet)
# nothing is returned
expect(result).to be_nil
pet = @pet_api.get_pet_by_id(id)
expect(pet.id).to eq(id)
expect(pet.name).to eq("RUBY UNIT TESTING")
expect(pet.photo_urls).to match_array(['www.photo-url.test'])
@pet_api.delete_pet(id)
end
it "should upload a file to a pet" do
result = @pet_api.upload_file(@pet_id, file: File.new('hello.txt'))
# ApiResponse is returned
expect(result).to be_a(Petstore::ApiResponse)
end
it "should upload a file with form parameter to a pet" do
result = @pet_api.upload_file(@pet_id, file: File.new('hello.txt'), additional_metadata: 'metadata')
# ApiResponse is returned
expect(result).to be_a(Petstore::ApiResponse)
end
it "should implement eql? and hash" do
pet_hash = {
name: 'test_name',
photo_urls: ['www.photo-url.test']
}
pet1 = Petstore::Pet.new(pet_hash)
pet2 = Petstore::Pet.new(pet_hash)
expect(pet1).to eq(pet2)
expect(pet2).to eq(pet1)
expect(pet1.eql?(pet2)).to eq(true)
expect(pet2.eql?(pet1)).to eq(true)
expect(pet1.hash).to eq(pet2.hash)
expect(pet1).to eq(pet1)
expect(pet1.eql?(pet1)).to eq(true)
expect(pet1.hash).to eq(pet1.hash)
pet1.name = 'really-happy'
pet1.photo_urls = ['http://foo.bar.com/1', 'http://foo.bar.com/2']
expect(pet1).not_to eq(pet2)
expect(pet2).not_to eq(pet1)
expect(pet1.eql?(pet2)).to eq(false)
expect(pet2.eql?(pet1)).to eq(false)
expect(pet1.hash).not_to eq(pet2.hash)
expect(pet1).to eq(pet1)
expect(pet1.eql?(pet1)).to eq(true)
expect(pet1.hash).to eq(pet1.hash)
pet2.name = 'really-happy'
pet2.photo_urls = ['http://foo.bar.com/1', 'http://foo.bar.com/2']
expect(pet1).to eq(pet2)
expect(pet2).to eq(pet1)
expect(pet1.eql?(pet2)).to eq(true)
expect(pet2.eql?(pet1)).to eq(true)
expect(pet1.hash).to eq(pet2.hash)
expect(pet2).to eq(pet2)
expect(pet2.eql?(pet2)).to eq(true)
expect(pet2.hash).to eq(pet2.hash)
end
end
end

View File

@@ -0,0 +1,39 @@
require 'spec_helper'
require 'petstore_helper'
describe "Store" do
before do
@api = Petstore::StoreApi.new(API_CLIENT)
end
it "should fetch an order" do
@order_id = prepare_store(@api)
item = @api.get_order_by_id(@order_id)
expect(item.id).to eq(@order_id)
@api.delete_order(@order_id)
end
it "should fetch the inventory" do
result = @api.get_inventory
expect(result).to be_a(Hash)
expect(result).not_to be_empty
result.each do |k, v|
expect(k).to be_a(Symbol)
expect(v).to be_a(Integer)
end
end
# mark as pending since original petstore does not return object
# will re-enable this after updating the petstore server
xit "should fetch the inventory in object" do
result = @api.get_inventory_in_object
expect(result).to be_a(Hash)
expect(result).not_to be_empty
result.each do |k, v|
expect(k).to be_a(Symbol)
expect(v).to be_a(Integer)
end
end
end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::AdditionalPropertiesClass
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::AdditionalPropertiesClass do
let(:instance) { Petstore::AdditionalPropertiesClass.new }
describe 'AdditionalPropertiesClass' do
before do
# run before each test
@instance = Petstore::AdditionalPropertiesClass.new
end
after do
# run after each test
end
describe 'test an instance of AdditionalPropertiesClass' do
it 'should create an instance of AdditionalPropertiesClass' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::AdditionalPropertiesClass)
expect(@instance).to be_instance_of(Petstore::AdditionalPropertiesClass)
end
end
describe 'test attribute "map_property"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 7.0.0-SNAPSHOT
=end
@@ -22,11 +22,9 @@ describe Petstore::AllOfWithSingleRef do
describe 'test an instance of AllOfWithSingleRef' do
it 'should create an instance of AllOfWithSingleRef' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::AllOfWithSingleRef)
expect(instance).to be_instance_of(Petstore::AllOfWithSingleRef)
end
end
describe 'test attribute "username"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::Animal
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::Animal do
let(:instance) { Petstore::Animal.new }
describe 'Animal' do
before do
# run before each test
@instance = Petstore::Animal.new
end
after do
# run after each test
end
describe 'test an instance of Animal' do
it 'should create an instance of Animal' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::Animal)
expect(@instance).to be_instance_of(Petstore::Animal)
end
end
describe 'test attribute "class_name"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::ApiResponse
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::ApiResponse do
let(:instance) { Petstore::ApiResponse.new }
describe 'ApiResponse' do
before do
# run before each test
@instance = Petstore::ApiResponse.new
end
after do
# run after each test
end
describe 'test an instance of ApiResponse' do
it 'should create an instance of ApiResponse' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::ApiResponse)
expect(@instance).to be_instance_of(Petstore::ApiResponse)
end
end
describe 'test attribute "code"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::ArrayOfArrayOfNumberOnly
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::ArrayOfArrayOfNumberOnly do
let(:instance) { Petstore::ArrayOfArrayOfNumberOnly.new }
describe 'ArrayOfArrayOfNumberOnly' do
before do
# run before each test
@instance = Petstore::ArrayOfArrayOfNumberOnly.new
end
after do
# run after each test
end
describe 'test an instance of ArrayOfArrayOfNumberOnly' do
it 'should create an instance of ArrayOfArrayOfNumberOnly' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::ArrayOfArrayOfNumberOnly)
expect(@instance).to be_instance_of(Petstore::ArrayOfArrayOfNumberOnly)
end
end
describe 'test attribute "array_array_number"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::ArrayOfNumberOnly
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::ArrayOfNumberOnly do
let(:instance) { Petstore::ArrayOfNumberOnly.new }
describe 'ArrayOfNumberOnly' do
before do
# run before each test
@instance = Petstore::ArrayOfNumberOnly.new
end
after do
# run after each test
end
describe 'test an instance of ArrayOfNumberOnly' do
it 'should create an instance of ArrayOfNumberOnly' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::ArrayOfNumberOnly)
expect(@instance).to be_instance_of(Petstore::ArrayOfNumberOnly)
end
end
describe 'test attribute "array_number"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::ArrayTest
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::ArrayTest do
let(:instance) { Petstore::ArrayTest.new }
describe 'ArrayTest' do
before do
# run before each test
@instance = Petstore::ArrayTest.new
end
after do
# run after each test
end
describe 'test an instance of ArrayTest' do
it 'should create an instance of ArrayTest' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::ArrayTest)
expect(@instance).to be_instance_of(Petstore::ArrayTest)
end
end
describe 'test attribute "array_of_string"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::Capitalization
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::Capitalization do
let(:instance) { Petstore::Capitalization.new }
describe 'Capitalization' do
before do
# run before each test
@instance = Petstore::Capitalization.new
end
after do
# run after each test
end
describe 'test an instance of Capitalization' do
it 'should create an instance of Capitalization' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::Capitalization)
expect(@instance).to be_instance_of(Petstore::Capitalization)
end
end
describe 'test attribute "small_camel"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::Cat
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::Cat do
let(:instance) { Petstore::Cat.new }
describe 'Cat' do
before do
# run before each test
@instance = Petstore::Cat.new
end
after do
# run after each test
end
describe 'test an instance of Cat' do
it 'should create an instance of Cat' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::Cat)
expect(@instance).to be_instance_of(Petstore::Cat)
end
end
describe 'test attribute "declawed"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::Category
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::Category do
let(:instance) { Petstore::Category.new }
describe 'Category' do
before do
# run before each test
@instance = Petstore::Category.new
end
after do
# run after each test
end
describe 'test an instance of Category' do
it 'should create an instance of Category' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::Category)
expect(@instance).to be_instance_of(Petstore::Category)
end
end
describe 'test attribute "id"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -1,36 +0,0 @@
=begin
#OpenAPI Petstore
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for Petstore::ChildWithNullable
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::ChildWithNullable do
let(:instance) { Petstore::ChildWithNullable.new }
describe 'test an instance of ChildWithNullable' do
it 'should create an instance of ChildWithNullable' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::ChildWithNullable)
end
end
describe 'test attribute "other_property"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
end
end
end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::ClassModel
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::ClassModel do
let(:instance) { Petstore::ClassModel.new }
describe 'ClassModel' do
before do
# run before each test
@instance = Petstore::ClassModel.new
end
after do
# run after each test
end
describe 'test an instance of ClassModel' do
it 'should create an instance of ClassModel' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::ClassModel)
expect(@instance).to be_instance_of(Petstore::ClassModel)
end
end
describe 'test attribute "_class"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::Client
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::Client do
let(:instance) { Petstore::Client.new }
describe 'Client' do
before do
# run before each test
@instance = Petstore::Client.new
end
after do
# run after each test
end
describe 'test an instance of Client' do
it 'should create an instance of Client' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::Client)
expect(@instance).to be_instance_of(Petstore::Client)
end
end
describe 'test attribute "client"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.2.0-SNAPSHOT
=end
@@ -22,11 +22,9 @@ describe Petstore::DeprecatedObject do
describe 'test an instance of DeprecatedObject' do
it 'should create an instance of DeprecatedObject' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::DeprecatedObject)
expect(instance).to be_instance_of(Petstore::DeprecatedObject)
end
end
describe 'test attribute "name"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::Dog
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::Dog do
let(:instance) { Petstore::Dog.new }
describe 'Dog' do
before do
# run before each test
@instance = Petstore::Dog.new
end
after do
# run after each test
end
describe 'test an instance of Dog' do
it 'should create an instance of Dog' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::Dog)
expect(@instance).to be_instance_of(Petstore::Dog)
end
end
describe 'test attribute "breed"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,22 +17,27 @@ require 'date'
# Unit tests for Petstore::EnumArrays
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::EnumArrays do
let(:instance) { Petstore::EnumArrays.new }
describe 'EnumArrays' do
before do
# run before each test
@instance = Petstore::EnumArrays.new
end
after do
# run after each test
end
describe 'test an instance of EnumArrays' do
it 'should create an instance of EnumArrays' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::EnumArrays)
expect(@instance).to be_instance_of(Petstore::EnumArrays)
end
end
describe 'test attribute "just_symbol"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', [">=", "$"])
# validator.allowable_values.each do |value|
# expect { instance.just_symbol = value }.not_to raise_error
# expect { @instance.just_symbol = value }.not_to raise_error
# end
end
end
@@ -42,7 +47,7 @@ describe Petstore::EnumArrays do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
# validator = Petstore::EnumTest::EnumAttributeValidator.new('Array<String>', ["fish", "crab"])
# validator.allowable_values.each do |value|
# expect { instance.array_enum = value }.not_to raise_error
# expect { @instance.array_enum = value }.not_to raise_error
# end
end
end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,14 +17,19 @@ require 'date'
# Unit tests for Petstore::EnumClass
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::EnumClass do
let(:instance) { Petstore::EnumClass.new }
describe 'EnumClass' do
before do
# run before each test
@instance = Petstore::EnumClass.new
end
after do
# run after each test
end
describe 'test an instance of EnumClass' do
it 'should create an instance of EnumClass' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::EnumClass)
expect(@instance).to be_instance_of(Petstore::EnumClass)
end
end
end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,22 +17,27 @@ require 'date'
# Unit tests for Petstore::EnumTest
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::EnumTest do
let(:instance) { Petstore::EnumTest.new }
describe 'EnumTest' do
before do
# run before each test
@instance = Petstore::EnumTest.new
end
after do
# run after each test
end
describe 'test an instance of EnumTest' do
it 'should create an instance of EnumTest' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::EnumTest)
expect(@instance).to be_instance_of(Petstore::EnumTest)
end
end
describe 'test attribute "enum_string"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["UPPER", "lower", ""])
# validator.allowable_values.each do |value|
# expect { instance.enum_string = value }.not_to raise_error
# expect { @instance.enum_string = value }.not_to raise_error
# end
end
end
@@ -42,7 +47,7 @@ describe Petstore::EnumTest do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["UPPER", "lower", ""])
# validator.allowable_values.each do |value|
# expect { instance.enum_string_required = value }.not_to raise_error
# expect { @instance.enum_string_required = value }.not_to raise_error
# end
end
end
@@ -52,7 +57,7 @@ describe Petstore::EnumTest do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
# validator = Petstore::EnumTest::EnumAttributeValidator.new('Integer', [1, -1])
# validator.allowable_values.each do |value|
# expect { instance.enum_integer = value }.not_to raise_error
# expect { @instance.enum_integer = value }.not_to raise_error
# end
end
end
@@ -62,7 +67,7 @@ describe Petstore::EnumTest do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
# validator = Petstore::EnumTest::EnumAttributeValidator.new('Float', [1.1, -1.2])
# validator.allowable_values.each do |value|
# expect { instance.enum_number = value }.not_to raise_error
# expect { @instance.enum_number = value }.not_to raise_error
# end
end
end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 7.0.0-SNAPSHOT
=end
@@ -22,11 +22,9 @@ describe Petstore::FakeBigDecimalMap200Response do
describe 'test an instance of FakeBigDecimalMap200Response' do
it 'should create an instance of FakeBigDecimalMap200Response' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::FakeBigDecimalMap200Response)
expect(instance).to be_instance_of(Petstore::FakeBigDecimalMap200Response)
end
end
describe 'test attribute "some_id"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::FileSchemaTestClass
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::FileSchemaTestClass do
let(:instance) { Petstore::FileSchemaTestClass.new }
describe 'FileSchemaTestClass' do
before do
# run before each test
@instance = Petstore::FileSchemaTestClass.new
end
after do
# run after each test
end
describe 'test an instance of FileSchemaTestClass' do
it 'should create an instance of FileSchemaTestClass' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::FileSchemaTestClass)
expect(@instance).to be_instance_of(Petstore::FileSchemaTestClass)
end
end
describe 'test attribute "file"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::File
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::File do
let(:instance) { Petstore::File.new }
describe 'File' do
before do
# run before each test
@instance = Petstore::File.new
end
after do
# run after each test
end
describe 'test an instance of File' do
it 'should create an instance of File' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::File)
expect(@instance).to be_instance_of(Petstore::File)
end
end
describe 'test attribute "source_uri"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
@@ -22,11 +22,9 @@ describe Petstore::FooGetDefaultResponse do
describe 'test an instance of FooGetDefaultResponse' do
it 'should create an instance of FooGetDefaultResponse' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::FooGetDefaultResponse)
expect(instance).to be_instance_of(Petstore::FooGetDefaultResponse)
end
end
describe 'test attribute "string"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::Foo
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::Foo do
let(:instance) { Petstore::Foo.new }
describe 'Foo' do
before do
# run before each test
@instance = Petstore::Foo.new
end
after do
# run after each test
end
describe 'test an instance of Foo' do
it 'should create an instance of Foo' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::Foo)
expect(@instance).to be_instance_of(Petstore::Foo)
end
end
describe 'test attribute "bar"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,26 @@ require 'date'
# Unit tests for Petstore::FormatTest
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::FormatTest do
let(:instance) { Petstore::FormatTest.new }
describe 'FormatTest' do
before do
# run before each test
@instance = Petstore::FormatTest.new({
number: 65,
byte: '1234356',
date: Date.parse('2007-12-03T10:15:30+01:00'),
password: 'password123'
})
end
after do
# run after each test
end
describe 'test an instance of FormatTest' do
it 'should create an instance of FormatTest' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::FormatTest)
expect(@instance).to be_instance_of(Petstore::FormatTest)
end
end
describe 'test attribute "integer"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
@@ -63,12 +73,6 @@ describe Petstore::FormatTest do
end
end
describe 'test attribute "decimal"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
end
end
describe 'test attribute "string"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::HasOnlyReadOnly
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::HasOnlyReadOnly do
let(:instance) { Petstore::HasOnlyReadOnly.new }
describe 'HasOnlyReadOnly' do
before do
# run before each test
@instance = Petstore::HasOnlyReadOnly.new
end
after do
# run after each test
end
describe 'test an instance of HasOnlyReadOnly' do
it 'should create an instance of HasOnlyReadOnly' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::HasOnlyReadOnly)
expect(@instance).to be_instance_of(Petstore::HasOnlyReadOnly)
end
end
describe 'test attribute "bar"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::HealthCheckResult
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::HealthCheckResult do
let(:instance) { Petstore::HealthCheckResult.new }
describe 'HealthCheckResult' do
before do
# run before each test
@instance = Petstore::HealthCheckResult.new
end
after do
# run after each test
end
describe 'test an instance of HealthCheckResult' do
it 'should create an instance of HealthCheckResult' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::HealthCheckResult)
expect(@instance).to be_instance_of(Petstore::HealthCheckResult)
end
end
describe 'test attribute "nullable_message"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::List
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::List do
let(:instance) { Petstore::List.new }
describe 'List' do
before do
# run before each test
@instance = Petstore::List.new
end
after do
# run after each test
end
describe 'test an instance of List' do
it 'should create an instance of List' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::List)
expect(@instance).to be_instance_of(Petstore::List)
end
end
describe 'test attribute "_123_list"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -0,0 +1,21 @@
=begin
#OpenAPI Petstore
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.0.0-SNAPSHOT
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for Petstore::MammalAnyof
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::MammalAnyof do
end

View File

@@ -0,0 +1,37 @@
=begin
#OpenAPI Petstore
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.0.0-SNAPSHOT
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for Petstore::Mammal
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::Mammal do
describe '.openapi_one_of' do
it 'lists the items referenced in the oneOf array' do
expect(described_class.openapi_one_of).to_not be_empty
end
end
describe '.openapi_discriminator_name' do
it 'returns the value of the "discriminator" property' do
expect(described_class.openapi_discriminator_name).to_not be_empty
end
end
describe '.build' do
it 'returns the correct model' do
end
end
end

View File

@@ -0,0 +1,31 @@
=begin
#OpenAPI Petstore
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.0.0-SNAPSHOT
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for Petstore::MammalWithoutDiscriminator
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::MammalWithoutDiscriminator do
describe '.openapi_one_of' do
it 'lists the items referenced in the oneOf array' do
expect(described_class.openapi_one_of).to_not be_empty
end
end
describe '.build' do
it 'returns the correct model' do
end
end
end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::MapTest
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::MapTest do
let(:instance) { Petstore::MapTest.new }
describe 'MapTest' do
before do
# run before each test
@instance = Petstore::MapTest.new
end
after do
# run after each test
end
describe 'test an instance of MapTest' do
it 'should create an instance of MapTest' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::MapTest)
expect(@instance).to be_instance_of(Petstore::MapTest)
end
end
describe 'test attribute "map_map_of_string"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
@@ -38,7 +43,7 @@ describe Petstore::MapTest do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
# validator = Petstore::EnumTest::EnumAttributeValidator.new('Hash<String, String>', ["UPPER", "lower"])
# validator.allowable_values.each do |value|
# expect { instance.map_of_enum_string = value }.not_to raise_error
# expect { @instance.map_of_enum_string = value }.not_to raise_error
# end
end
end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::MixedPropertiesAndAdditionalPropertiesClass
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::MixedPropertiesAndAdditionalPropertiesClass do
let(:instance) { Petstore::MixedPropertiesAndAdditionalPropertiesClass.new }
describe 'MixedPropertiesAndAdditionalPropertiesClass' do
before do
# run before each test
@instance = Petstore::MixedPropertiesAndAdditionalPropertiesClass.new
end
after do
# run after each test
end
describe 'test an instance of MixedPropertiesAndAdditionalPropertiesClass' do
it 'should create an instance of MixedPropertiesAndAdditionalPropertiesClass' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::MixedPropertiesAndAdditionalPropertiesClass)
expect(@instance).to be_instance_of(Petstore::MixedPropertiesAndAdditionalPropertiesClass)
end
end
describe 'test attribute "uuid"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::Model200Response
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::Model200Response do
let(:instance) { Petstore::Model200Response.new }
describe 'Model200Response' do
before do
# run before each test
@instance = Petstore::Model200Response.new
end
after do
# run after each test
end
describe 'test an instance of Model200Response' do
it 'should create an instance of Model200Response' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::Model200Response)
expect(@instance).to be_instance_of(Petstore::Model200Response)
end
end
describe 'test attribute "name"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::ModelReturn
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::ModelReturn do
let(:instance) { Petstore::ModelReturn.new }
describe 'ModelReturn' do
before do
# run before each test
@instance = Petstore::ModelReturn.new
end
after do
# run after each test
end
describe 'test an instance of ModelReturn' do
it 'should create an instance of ModelReturn' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::ModelReturn)
expect(@instance).to be_instance_of(Petstore::ModelReturn)
end
end
describe 'test attribute "_return"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::Name
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::Name do
let(:instance) { Petstore::Name.new }
describe 'Name' do
before do
# run before each test
@instance = Petstore::Name.new
end
after do
# run after each test
end
describe 'test an instance of Name' do
it 'should create an instance of Name' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::Name)
expect(@instance).to be_instance_of(Petstore::Name)
end
end
describe 'test attribute "name"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::NullableClass
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::NullableClass do
let(:instance) { Petstore::NullableClass.new }
describe 'NullableClass' do
before do
# run before each test
@instance = Petstore::NullableClass.new
end
after do
# run after each test
end
describe 'test an instance of NullableClass' do
it 'should create an instance of NullableClass' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::NullableClass)
expect(@instance).to be_instance_of(Petstore::NullableClass)
end
end
describe 'test attribute "integer_prop"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::NumberOnly
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::NumberOnly do
let(:instance) { Petstore::NumberOnly.new }
describe 'NumberOnly' do
before do
# run before each test
@instance = Petstore::NumberOnly.new
end
after do
# run after each test
end
describe 'test an instance of NumberOnly' do
it 'should create an instance of NumberOnly' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::NumberOnly)
expect(@instance).to be_instance_of(Petstore::NumberOnly)
end
end
describe 'test attribute "just_number"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.2.0-SNAPSHOT
=end
@@ -22,11 +22,9 @@ describe Petstore::ObjectWithDeprecatedFields do
describe 'test an instance of ObjectWithDeprecatedFields' do
it 'should create an instance of ObjectWithDeprecatedFields' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::ObjectWithDeprecatedFields)
expect(instance).to be_instance_of(Petstore::ObjectWithDeprecatedFields)
end
end
describe 'test attribute "uuid"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::Order
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::Order do
let(:instance) { Petstore::Order.new }
describe 'Order' do
before do
# run before each test
@instance = Petstore::Order.new
end
after do
# run after each test
end
describe 'test an instance of Order' do
it 'should create an instance of Order' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::Order)
expect(@instance).to be_instance_of(Petstore::Order)
end
end
describe 'test attribute "id"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
@@ -56,7 +61,7 @@ describe Petstore::Order do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["placed", "approved", "delivered"])
# validator.allowable_values.each do |value|
# expect { instance.status = value }.not_to raise_error
# expect { @instance.status = value }.not_to raise_error
# end
end
end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::OuterComposite
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::OuterComposite do
let(:instance) { Petstore::OuterComposite.new }
describe 'OuterComposite' do
before do
# run before each test
@instance = Petstore::OuterComposite.new
end
after do
# run after each test
end
describe 'test an instance of OuterComposite' do
it 'should create an instance of OuterComposite' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::OuterComposite)
expect(@instance).to be_instance_of(Petstore::OuterComposite)
end
end
describe 'test attribute "my_number"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,14 +17,19 @@ require 'date'
# Unit tests for Petstore::OuterEnumDefaultValue
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::OuterEnumDefaultValue do
let(:instance) { Petstore::OuterEnumDefaultValue.new }
describe 'OuterEnumDefaultValue' do
before do
# run before each test
@instance = Petstore::OuterEnumDefaultValue.new
end
after do
# run after each test
end
describe 'test an instance of OuterEnumDefaultValue' do
it 'should create an instance of OuterEnumDefaultValue' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::OuterEnumDefaultValue)
expect(@instance).to be_instance_of(Petstore::OuterEnumDefaultValue)
end
end
end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,14 +17,19 @@ require 'date'
# Unit tests for Petstore::OuterEnumIntegerDefaultValue
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::OuterEnumIntegerDefaultValue do
let(:instance) { Petstore::OuterEnumIntegerDefaultValue.new }
describe 'OuterEnumIntegerDefaultValue' do
before do
# run before each test
@instance = Petstore::OuterEnumIntegerDefaultValue.new
end
after do
# run after each test
end
describe 'test an instance of OuterEnumIntegerDefaultValue' do
it 'should create an instance of OuterEnumIntegerDefaultValue' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::OuterEnumIntegerDefaultValue)
expect(@instance).to be_instance_of(Petstore::OuterEnumIntegerDefaultValue)
end
end
end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,14 +17,19 @@ require 'date'
# Unit tests for Petstore::OuterEnumInteger
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::OuterEnumInteger do
let(:instance) { Petstore::OuterEnumInteger.new }
describe 'OuterEnumInteger' do
before do
# run before each test
@instance = Petstore::OuterEnumInteger.new
end
after do
# run after each test
end
describe 'test an instance of OuterEnumInteger' do
it 'should create an instance of OuterEnumInteger' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::OuterEnumInteger)
expect(@instance).to be_instance_of(Petstore::OuterEnumInteger)
end
end
end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,14 +17,19 @@ require 'date'
# Unit tests for Petstore::OuterEnum
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::OuterEnum do
let(:instance) { Petstore::OuterEnum.new }
describe 'OuterEnum' do
before do
# run before each test
@instance = Petstore::OuterEnum.new
end
after do
# run after each test
end
describe 'test an instance of OuterEnum' do
it 'should create an instance of OuterEnum' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::OuterEnum)
expect(@instance).to be_instance_of(Petstore::OuterEnum)
end
end
end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.1.0-SNAPSHOT
=end
@@ -22,11 +22,9 @@ describe Petstore::OuterObjectWithEnumProperty do
describe 'test an instance of OuterObjectWithEnumProperty' do
it 'should create an instance of OuterObjectWithEnumProperty' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::OuterObjectWithEnumProperty)
expect(instance).to be_instance_of(Petstore::OuterObjectWithEnumProperty)
end
end
describe 'test attribute "value"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::Pet
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::Pet do
let(:instance) { Petstore::Pet.new }
describe 'Pet' do
before do
# run before each test
@instance = Petstore::Pet.new({ name: 'Kitty', photo_urls: ['www.photo-url.test'] })
end
after do
# run after each test
end
describe 'test an instance of Pet' do
it 'should create an instance of Pet' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::Pet)
expect(@instance).to be_instance_of(Petstore::Pet)
end
end
describe 'test attribute "id"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
@@ -62,7 +67,7 @@ describe Petstore::Pet do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["available", "pending", "sold"])
# validator.allowable_values.each do |value|
# expect { instance.status = value }.not_to raise_error
# expect { @instance.status = value }.not_to raise_error
# end
end
end

View File

@@ -0,0 +1,52 @@
=begin
#OpenAPI Petstore
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.0.0-SNAPSHOT
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for Petstore::PropertyNameMapping
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::PropertyNameMapping do
let(:instance) { Petstore::PropertyNameMapping.new }
describe 'test an instance of PropertyNameMapping' do
it 'should create an instance of PropertyNameMapping' do
expect(instance).to be_instance_of(Petstore::PropertyNameMapping)
end
end
describe 'test attribute "http_debug_operation"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
end
end
describe 'test attribute "underscore_type"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
end
end
describe 'test attribute "type"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
end
end
describe 'test attribute "type_with_underscore"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
end
end
end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::ReadOnlyFirst
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::ReadOnlyFirst do
let(:instance) { Petstore::ReadOnlyFirst.new }
describe 'ReadOnlyFirst' do
before do
# run before each test
@instance = Petstore::ReadOnlyFirst.new
end
after do
# run after each test
end
describe 'test an instance of ReadOnlyFirst' do
it 'should create an instance of ReadOnlyFirst' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::ReadOnlyFirst)
expect(@instance).to be_instance_of(Petstore::ReadOnlyFirst)
end
end
describe 'test attribute "bar"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
@@ -22,9 +22,7 @@ describe Petstore::SingleRefType do
describe 'test an instance of SingleRefType' do
it 'should create an instance of SingleRefType' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::SingleRefType)
expect(instance).to be_instance_of(Petstore::SingleRefType)
end
end
end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::SpecialModelName
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::SpecialModelName do
let(:instance) { Petstore::SpecialModelName.new }
describe 'SpecialModelName' do
before do
# run before each test
@instance = Petstore::SpecialModelName.new
end
after do
# run after each test
end
describe 'test an instance of SpecialModelName' do
it 'should create an instance of SpecialModelName' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::SpecialModelName)
expect(@instance).to be_instance_of(Petstore::SpecialModelName)
end
end
describe 'test attribute "special_property_name"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::Tag
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::Tag do
let(:instance) { Petstore::Tag.new }
describe 'Tag' do
before do
# run before each test
@instance = Petstore::Tag.new
end
after do
# run after each test
end
describe 'test an instance of Tag' do
it 'should create an instance of Tag' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::Tag)
expect(@instance).to be_instance_of(Petstore::Tag)
end
end
describe 'test attribute "id"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 7.0.1-SNAPSHOT
=end
@@ -22,11 +22,9 @@ describe Petstore::TestInlineFreeformAdditionalPropertiesRequest do
describe 'test an instance of TestInlineFreeformAdditionalPropertiesRequest' do
it 'should create an instance of TestInlineFreeformAdditionalPropertiesRequest' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::TestInlineFreeformAdditionalPropertiesRequest)
expect(instance).to be_instance_of(Petstore::TestInlineFreeformAdditionalPropertiesRequest)
end
end
describe 'test attribute "some_property"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@@ -17,16 +17,21 @@ require 'date'
# Unit tests for Petstore::User
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::User do
let(:instance) { Petstore::User.new }
describe 'User' do
before do
# run before each test
@instance = Petstore::User.new
end
after do
# run after each test
end
describe 'test an instance of User' do
it 'should create an instance of User' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::User)
expect(@instance).to be_instance_of(Petstore::User)
end
end
describe 'test attribute "id"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/

View File

@@ -0,0 +1,46 @@
=begin
#OpenAPI Petstore
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.0.0-SNAPSHOT
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for Petstore::Whale
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::Whale do
let(:instance) { Petstore::Whale.new }
describe 'test an instance of Whale' do
it 'should create an instance of Whale' do
expect(instance).to be_instance_of(Petstore::Whale)
end
end
describe 'test attribute "has_baleen"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
end
end
describe 'test attribute "has_teeth"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
end
end
describe 'test attribute "class_name"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
end
end
end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0-SNAPSHOT
OpenAPI Generator version: 7.0.0-SNAPSHOT
=end
@@ -14,30 +14,28 @@ require 'spec_helper'
require 'json'
require 'date'
# Unit tests for Petstore::ParentWithNullable
# Unit tests for Petstore::Zebra
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::ParentWithNullable do
let(:instance) { Petstore::ParentWithNullable.new }
describe Petstore::Zebra do
let(:instance) { Petstore::Zebra.new }
describe 'test an instance of ParentWithNullable' do
it 'should create an instance of ParentWithNullable' do
# uncomment below to test the instance creation
#expect(instance).to be_instance_of(Petstore::ParentWithNullable)
describe 'test an instance of Zebra' do
it 'should create an instance of Zebra' do
expect(instance).to be_instance_of(Petstore::Zebra)
end
end
describe 'test attribute "type"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["ChildWithNullable"])
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["plains", "mountain", "grevys"])
# validator.allowable_values.each do |value|
# expect { instance.type = value }.not_to raise_error
# end
end
end
describe 'test attribute "nullable_property"' do
describe 'test attribute "class_name"' do
it 'should work' do
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
end

View File

@@ -0,0 +1,50 @@
# load the gem
require 'petstore'
# API client (shared between all the test cases)
API_CLIENT = Petstore::ApiClient.new(Petstore::Configuration.new)
# randomly generate an ID
def random_id
rand(1000000) + 20000
end
# create a random pet, return its id
def prepare_pet(pet_api)
pet_id = random_id
category = Petstore::Category.new('id' => 20002, 'name' => 'category test')
tag = Petstore::Tag.new('id' => 30002, 'name' => 'tag test')
pet = Petstore::Pet.new('id' => pet_id, 'name' => "RUBY UNIT TESTING", 'photo_urls' => 'photo url',
'category' => category, 'tags' => [tag], 'status' => 'pending')
pet_api.add_pet(pet)
pet_id
end
# create a random order, return its id
def prepare_store(store_api)
order_id = 5
order = Petstore::Order.new("id" => order_id,
"pet_id" => 123,
"quantity" => 789,
"ship_date" => "2015-04-06T23:42:01.678Z",
"status" => "placed",
"complete" => false)
store_api.place_order(order)
order_id
end
# A random string to tack onto stuff to ensure we're not seeing
# data from a previous test run
RAND = ("a".."z").to_a.sample(8).join
# helper method to serialize object to json string
def serialize_json(o)
API_CLIENT.object_to_http_body(o)
end
# helper method to deserialize json string back to object
def deserialize_json(s, type)
headers = { 'Content-Type' => 'application/json' }
response = double('response', headers: headers, body: s)
API_CLIENT.deserialize(response, type)
end