specs/api/countries_api_spec.rb in velopayments-2.20.119 vs specs/api/countries_api_spec.rb in velopayments-2.23.78.beta1

- old
+ new

@@ -10,18 +10,47 @@ =end require 'spec_helper' require 'json' +require 'base64' # Unit tests for VeloPayments::CountriesApi # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe 'CountriesApi' do before do # run before each test + + if ENV['APITOKEN'] == "" + VeloPayments.configure do |config| + config.username = ENV['KEY'] + config.password = ENV['SECRET'] + end + + api_instance = VeloPayments::LoginApi.new + opts = { + grant_type: 'client_credentials' + } + + begin + res = api_instance.velo_auth(opts) + + ENV['APITOKEN'] = res.access_token + rescue VeloPayments::ApiError => e + puts "Exception when calling LoginApi->velo_auth: #{e}" + end + end + + uri = URI.parse(ENV['APIURL']) + VeloPayments.configure do |config| + config.access_token = ENV['APITOKEN'] + config.host = uri.host + end + @api_instance = VeloPayments::CountriesApi.new + end after do # run after each test end @@ -30,39 +59,45 @@ it 'should create an instance of CountriesApi' do expect(@api_instance).to be_instance_of(VeloPayments::CountriesApi) end end - # unit tests for list_supported_countries + # unit tests for list_supported_countries_v1 # List Supported Countries - # List the supported countries. + # <p>List the supported countries.</p> <p>This version will be retired in March 2020. Use /v2/supportedCountries</p> # @param [Hash] opts the optional parameters - # @return [SupportedCountriesResponse2] - describe 'list_supported_countries test' do + # @return [SupportedCountriesResponse] + describe 'list_supported_countries_v1 test' do it 'should work' do - # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + res = @api_instance.list_supported_countries_v1 + expect(res.countries.length()).to be > 1 + expect(@api_instance).to respond_to(:list_supported_countries_v1) end end - # unit tests for list_supported_countries_v1 + # unit tests for list_supported_countries_v2 # List Supported Countries - # <p>List the supported countries.</p> <p>This version will be retired in March 2020. Use /v2/supportedCountries</p> + # List the supported countries. # @param [Hash] opts the optional parameters - # @return [SupportedCountriesResponse] - describe 'list_supported_countries_v1 test' do + # @return [SupportedCountriesResponse2] + describe 'list_supported_countries_v2 test' do it 'should work' do - # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + res = @api_instance.list_supported_countries_v2 + expect(res.countries.length()).to be > 1 + expect(@api_instance).to respond_to(:list_supported_countries_v2) end end - # unit tests for v1_payment_channel_rules_get + # unit tests for list_payment_channel_rules_v1 # List Payment Channel Country Rules # List the country specific payment channel rules. # @param [Hash] opts the optional parameters # @return [PaymentChannelRulesResponse] - describe 'v1_payment_channel_rules_get test' do + describe 'list_payment_channel_rules_v1 test' do it 'should work' do - # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + res = @api_instance.list_payment_channel_rules_v1 + expect(res.bank.length()).to be > 1 + expect(@api_instance).to respond_to(:list_payment_channel_rules_v1) end end end