automation-test 1.14 → 1.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -29
- data/lib/{coin_gecko_apiv3 → apimatic_calculator_test}/api_helper.rb +2 -2
- data/lib/apimatic_calculator_test/client.rb +35 -0
- data/lib/{coin_gecko_apiv3 → apimatic_calculator_test}/configuration.rb +4 -3
- data/lib/{coin_gecko_apiv3 → apimatic_calculator_test}/controllers/base_controller.rb +2 -2
- data/lib/apimatic_calculator_test/controllers/simple_calculator_controller.rb +53 -0
- data/lib/{coin_gecko_apiv3 → apimatic_calculator_test}/exceptions/api_exception.rb +2 -2
- data/lib/{coin_gecko_apiv3 → apimatic_calculator_test}/http/faraday_client.rb +2 -2
- data/lib/{coin_gecko_apiv3 → apimatic_calculator_test}/http/http_call_back.rb +2 -2
- data/lib/{coin_gecko_apiv3 → apimatic_calculator_test}/http/http_client.rb +2 -2
- data/lib/{coin_gecko_apiv3 → apimatic_calculator_test}/http/http_method_enum.rb +2 -2
- data/lib/{coin_gecko_apiv3 → apimatic_calculator_test}/http/http_request.rb +2 -2
- data/lib/{coin_gecko_apiv3 → apimatic_calculator_test}/http/http_response.rb +2 -2
- data/lib/{coin_gecko_apiv3 → apimatic_calculator_test}/models/base_model.rb +2 -2
- data/lib/apimatic_calculator_test/models/operation_type_enum.rb +23 -0
- data/lib/{coin_gecko_apiv3 → apimatic_calculator_test}/utilities/date_time_helper.rb +2 -2
- data/lib/{coin_gecko_apiv3 → apimatic_calculator_test}/utilities/file_wrapper.rb +2 -2
- data/lib/apimatic_calculator_test.rb +39 -0
- metadata +21 -86
- data/lib/coin_gecko_apiv3/client.rb +0 -125
- data/lib/coin_gecko_apiv3/controllers/asset_platforms_controller.rb +0 -29
- data/lib/coin_gecko_apiv3/controllers/categories_controller.rb +0 -52
- data/lib/coin_gecko_apiv3/controllers/coins_controller.rb +0 -389
- data/lib/coin_gecko_apiv3/controllers/companies_beta_controller.rb +0 -35
- data/lib/coin_gecko_apiv3/controllers/contract_controller.rb +0 -119
- data/lib/coin_gecko_apiv3/controllers/derivatives_controller.rb +0 -112
- data/lib/coin_gecko_apiv3/controllers/events_controller.rb +0 -89
- data/lib/coin_gecko_apiv3/controllers/exchange_rates_controller.rb +0 -29
- data/lib/coin_gecko_apiv3/controllers/exchanges_controller.rb +0 -192
- data/lib/coin_gecko_apiv3/controllers/finance_controller.rb +0 -71
- data/lib/coin_gecko_apiv3/controllers/global_controller.rb +0 -29
- data/lib/coin_gecko_apiv3/controllers/indexes_controller.rb +0 -79
- data/lib/coin_gecko_apiv3/controllers/ping_controller.rb +0 -29
- data/lib/coin_gecko_apiv3/controllers/simple_controller.rb +0 -126
- data/lib/coin_gecko_apiv3/controllers/status_updates_controller.rb +0 -48
- data/lib/coin_gecko_apiv3/controllers/trending_controller.rb +0 -30
- data/lib/coin_gecko_apiv3.rb +0 -52
- data/test/controllers/controller_test_base.rb +0 -21
- data/test/controllers/test_asset_platforms_controller.rb +0 -25
- data/test/controllers/test_categories_controller.rb +0 -37
- data/test/controllers/test_coins_controller.rb +0 -27
- data/test/controllers/test_derivatives_controller.rb +0 -51
- data/test/controllers/test_events_controller.rb +0 -55
- data/test/controllers/test_exchange_rates_controller.rb +0 -26
- data/test/controllers/test_exchanges_controller.rb +0 -38
- data/test/controllers/test_finance_controller.rb +0 -43
- data/test/controllers/test_global_controller.rb +0 -26
- data/test/controllers/test_indexes_controller.rb +0 -38
- data/test/controllers/test_ping_controller.rb +0 -26
- data/test/controllers/test_simple_controller.rb +0 -25
- data/test/controllers/test_status_updates_controller.rb +0 -31
- data/test/controllers/test_trending_controller.rb +0 -25
- data/test/http_response_catcher.rb +0 -19
- data/test/test_helper.rb +0 -94
@@ -1,43 +0,0 @@
|
|
1
|
-
# coin_gecko_apiv3
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v2.0
|
4
|
-
# ( https://apimatic.io ).
|
5
|
-
|
6
|
-
require_relative 'controller_test_base'
|
7
|
-
|
8
|
-
class FinanceControllerTests < ControllerTestBase
|
9
|
-
# Called only once for the class before any test has executed
|
10
|
-
def setup
|
11
|
-
@response_catcher = HttpResponseCatcher.new
|
12
|
-
@controller = FinanceController.new CONFIG, http_call_back: @response_catcher
|
13
|
-
end
|
14
|
-
|
15
|
-
# List all finance platforms
|
16
|
-
def test_listallfinanceplatforms()
|
17
|
-
# Parameters for the API call
|
18
|
-
per_page = nil
|
19
|
-
page = nil
|
20
|
-
|
21
|
-
# Perform the API call through the SDK function
|
22
|
-
@controller.listallfinanceplatforms(per_page: per_page, page: page)
|
23
|
-
|
24
|
-
# Test response code
|
25
|
-
assert_equal(200, @response_catcher.response.status_code)
|
26
|
-
end
|
27
|
-
|
28
|
-
# List all finance products
|
29
|
-
def test_listallfinanceproducts()
|
30
|
-
# Parameters for the API call
|
31
|
-
per_page = nil
|
32
|
-
page = nil
|
33
|
-
start_at = nil
|
34
|
-
end_at = nil
|
35
|
-
|
36
|
-
# Perform the API call through the SDK function
|
37
|
-
@controller.listallfinanceproducts(per_page: per_page, page: page, start_at: start_at, end_at: end_at)
|
38
|
-
|
39
|
-
# Test response code
|
40
|
-
assert_equal(200, @response_catcher.response.status_code)
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# coin_gecko_apiv3
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v2.0
|
4
|
-
# ( https://apimatic.io ).
|
5
|
-
|
6
|
-
require_relative 'controller_test_base'
|
7
|
-
|
8
|
-
class GlobalControllerTests < ControllerTestBase
|
9
|
-
# Called only once for the class before any test has executed
|
10
|
-
def setup
|
11
|
-
@response_catcher = HttpResponseCatcher.new
|
12
|
-
@controller = GlobalController.new CONFIG, http_call_back: @response_catcher
|
13
|
-
end
|
14
|
-
|
15
|
-
# Get cryptocurrency global data
|
16
|
-
#
|
17
|
-
def test_getcryptocurrencyglobaldata()
|
18
|
-
|
19
|
-
# Perform the API call through the SDK function
|
20
|
-
@controller.getcryptocurrencyglobaldata()
|
21
|
-
|
22
|
-
# Test response code
|
23
|
-
assert_equal(200, @response_catcher.response.status_code)
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# coin_gecko_apiv3
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v2.0
|
4
|
-
# ( https://apimatic.io ).
|
5
|
-
|
6
|
-
require_relative 'controller_test_base'
|
7
|
-
|
8
|
-
class IndexesControllerTests < ControllerTestBase
|
9
|
-
# Called only once for the class before any test has executed
|
10
|
-
def setup
|
11
|
-
@response_catcher = HttpResponseCatcher.new
|
12
|
-
@controller = IndexesController.new CONFIG, http_call_back: @response_catcher
|
13
|
-
end
|
14
|
-
|
15
|
-
# List all market indexes
|
16
|
-
def test_listallmarketindexes()
|
17
|
-
# Parameters for the API call
|
18
|
-
per_page = nil
|
19
|
-
page = nil
|
20
|
-
|
21
|
-
# Perform the API call through the SDK function
|
22
|
-
@controller.listallmarketindexes(per_page: per_page, page: page)
|
23
|
-
|
24
|
-
# Test response code
|
25
|
-
assert_equal(200, @response_catcher.response.status_code)
|
26
|
-
end
|
27
|
-
|
28
|
-
# list market indexes id and name
|
29
|
-
def test_listmarketindexesidandname()
|
30
|
-
|
31
|
-
# Perform the API call through the SDK function
|
32
|
-
@controller.listmarketindexesidandname()
|
33
|
-
|
34
|
-
# Test response code
|
35
|
-
assert_equal(200, @response_catcher.response.status_code)
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# coin_gecko_apiv3
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v2.0
|
4
|
-
# ( https://apimatic.io ).
|
5
|
-
|
6
|
-
require_relative 'controller_test_base'
|
7
|
-
|
8
|
-
class PingControllerTests < ControllerTestBase
|
9
|
-
# Called only once for the class before any test has executed
|
10
|
-
def setup
|
11
|
-
@response_catcher = HttpResponseCatcher.new
|
12
|
-
@controller = PingController.new CONFIG, http_call_back: @response_catcher
|
13
|
-
end
|
14
|
-
|
15
|
-
# Check API server status
|
16
|
-
#
|
17
|
-
def test_check_ap_iserverstatus()
|
18
|
-
|
19
|
-
# Perform the API call through the SDK function
|
20
|
-
@controller.check_ap_iserverstatus()
|
21
|
-
|
22
|
-
# Test response code
|
23
|
-
assert_equal(200, @response_catcher.response.status_code)
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# coin_gecko_apiv3
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v2.0
|
4
|
-
# ( https://apimatic.io ).
|
5
|
-
|
6
|
-
require_relative 'controller_test_base'
|
7
|
-
|
8
|
-
class SimpleControllerTests < ControllerTestBase
|
9
|
-
# Called only once for the class before any test has executed
|
10
|
-
def setup
|
11
|
-
@response_catcher = HttpResponseCatcher.new
|
12
|
-
@controller = SimpleController.new CONFIG, http_call_back: @response_catcher
|
13
|
-
end
|
14
|
-
|
15
|
-
# Get list of supported_vs_currencies.
|
16
|
-
def test_getlistofsupported_vs_currencies()
|
17
|
-
|
18
|
-
# Perform the API call through the SDK function
|
19
|
-
@controller.getlistofsupported_vs_currencies()
|
20
|
-
|
21
|
-
# Test response code
|
22
|
-
assert_equal(200, @response_catcher.response.status_code)
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# coin_gecko_apiv3
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v2.0
|
4
|
-
# ( https://apimatic.io ).
|
5
|
-
|
6
|
-
require_relative 'controller_test_base'
|
7
|
-
|
8
|
-
class StatusUpdatesControllerTests < ControllerTestBase
|
9
|
-
# Called only once for the class before any test has executed
|
10
|
-
def setup
|
11
|
-
@response_catcher = HttpResponseCatcher.new
|
12
|
-
@controller = StatusUpdatesController.new CONFIG, http_call_back: @response_catcher
|
13
|
-
end
|
14
|
-
|
15
|
-
# List all status_updates with data (description, category, created_at, user, user_title and pin)
|
16
|
-
#
|
17
|
-
def test_listallstatus_updateswithdata_description_category_created_at_user_user_titleandpin()
|
18
|
-
# Parameters for the API call
|
19
|
-
category = nil
|
20
|
-
project_type = nil
|
21
|
-
per_page = nil
|
22
|
-
page = nil
|
23
|
-
|
24
|
-
# Perform the API call through the SDK function
|
25
|
-
@controller.listallstatus_updateswithdata_description_category_created_at_user_user_titleandpin(category: category, project_type: project_type, per_page: per_page, page: page)
|
26
|
-
|
27
|
-
# Test response code
|
28
|
-
assert_equal(200, @response_catcher.response.status_code)
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# coin_gecko_apiv3
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v2.0
|
4
|
-
# ( https://apimatic.io ).
|
5
|
-
|
6
|
-
require_relative 'controller_test_base'
|
7
|
-
|
8
|
-
class TrendingControllerTests < ControllerTestBase
|
9
|
-
# Called only once for the class before any test has executed
|
10
|
-
def setup
|
11
|
-
@response_catcher = HttpResponseCatcher.new
|
12
|
-
@controller = TrendingController.new CONFIG, http_call_back: @response_catcher
|
13
|
-
end
|
14
|
-
|
15
|
-
# Top-7 trending coins on CoinGecko as searched by users in the last 24 hours (Ordered by most popular first)
|
16
|
-
def test_gettrendingsearchcoins_top_7_on_coin_geckointhelast24hours()
|
17
|
-
|
18
|
-
# Perform the API call through the SDK function
|
19
|
-
@controller.gettrendingsearchcoins_top_7_on_coin_geckointhelast24hours()
|
20
|
-
|
21
|
-
# Test response code
|
22
|
-
assert_equal(200, @response_catcher.response.status_code)
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# coin_gecko_apiv3
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v2.0
|
4
|
-
# ( https://apimatic.io ).
|
5
|
-
|
6
|
-
class HttpResponseCatcher < CoinGeckoApiv3::HttpCallBack
|
7
|
-
attr_accessor :response
|
8
|
-
|
9
|
-
def on_before_request(request)
|
10
|
-
end
|
11
|
-
|
12
|
-
# Catching the response
|
13
|
-
def on_after_response(response)
|
14
|
-
@response = response
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
|
-
|
data/test/test_helper.rb
DELETED
@@ -1,94 +0,0 @@
|
|
1
|
-
# coin_gecko_apiv3
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v2.0
|
4
|
-
# ( https://apimatic.io ).
|
5
|
-
|
6
|
-
require 'tempfile'
|
7
|
-
require 'open-uri'
|
8
|
-
|
9
|
-
class TestHelper
|
10
|
-
|
11
|
-
@cache = Hash.new
|
12
|
-
|
13
|
-
# Class method to compare the received headers with the expected headers.
|
14
|
-
# @param [Hash] A hash of expected headers (keys in lower case).
|
15
|
-
# @param [Hash] A hash of received headers.
|
16
|
-
# @param [Boolean, optional] A flag which determines if we allow extra headers.
|
17
|
-
def self.match_headers(expected_headers,
|
18
|
-
received_headers,
|
19
|
-
allow_extra: true)
|
20
|
-
return false if ((received_headers.length < expected_headers.length) ||
|
21
|
-
((allow_extra == false) && (received_headers.length > expected_headers.length)))
|
22
|
-
|
23
|
-
received_headers = Hash[received_headers.map{|k, v| [k.to_s.downcase, v]}]
|
24
|
-
expected_headers.each do |e_key, e_value|
|
25
|
-
return false unless received_headers.key?(e_key)
|
26
|
-
return false if ((e_value != nil) &&
|
27
|
-
(e_value != received_headers[e_key]))
|
28
|
-
end
|
29
|
-
|
30
|
-
return true
|
31
|
-
end
|
32
|
-
|
33
|
-
# Class method to compare the received body with the expected body.
|
34
|
-
# @param [Dynamic] The expected body.
|
35
|
-
# @param [Dynamic] The received body.
|
36
|
-
# @param [Boolean, optional] A flag which determines if we check values in dictionaries.
|
37
|
-
# @param [Boolean, optional] A flag which determines if we check the order of array elements.
|
38
|
-
# @param [Boolean, optional] A flag which determines if we check the count of array elements.
|
39
|
-
def self.match_body(expected_body,
|
40
|
-
received_body,
|
41
|
-
check_values: false,
|
42
|
-
check_order: false,
|
43
|
-
check_count: false)
|
44
|
-
if expected_body.instance_of? Hash
|
45
|
-
return false unless received_body.instance_of? Hash
|
46
|
-
for key in expected_body.keys
|
47
|
-
return false unless received_body.keys.include? key
|
48
|
-
if check_values or expected_body[key].instance_of? Hash
|
49
|
-
return false unless TestHelper.match_body(expected_body[key],
|
50
|
-
received_body[key],
|
51
|
-
check_values: check_values,
|
52
|
-
check_order: check_order,
|
53
|
-
check_count: check_count)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
elsif expected_body.instance_of? Array
|
57
|
-
return False unless received_body.instance_of? Array
|
58
|
-
if check_count == true && (expected_body.length != received_body.length)
|
59
|
-
return false
|
60
|
-
else
|
61
|
-
previous_matches = Array.new
|
62
|
-
expected_body.each.with_index do |expected_element, i|
|
63
|
-
matches = (received_body.map.with_index do |received_element, j|
|
64
|
-
j if TestHelper.match_body(expected_element,
|
65
|
-
received_element,
|
66
|
-
check_values: check_values,
|
67
|
-
check_order: check_order,
|
68
|
-
check_count: check_count)
|
69
|
-
end).compact
|
70
|
-
return false if matches.length == 0
|
71
|
-
if check_order == true
|
72
|
-
return false if (i != 0 && matches.map{|x| previous_matches.map{|y| y > x}.all?}.all?)
|
73
|
-
previous_matches = matches
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
elsif expected_body != received_body
|
78
|
-
return false
|
79
|
-
end
|
80
|
-
return true
|
81
|
-
end
|
82
|
-
|
83
|
-
# Class method which takes a URL, downloads the file (if not already downloaded
|
84
|
-
# for this test session) and returns the path of the file.
|
85
|
-
# @param [String] The URL of the required file.
|
86
|
-
def self.get_file(url)
|
87
|
-
unless @cache.keys.include? url
|
88
|
-
@cache[url] = Tempfile.new('APIMatic')
|
89
|
-
@cache[url].binmode
|
90
|
-
@cache[url].write(open(url, {ssl_ca_cert: Certifi.where}).read)
|
91
|
-
end
|
92
|
-
return @cache[url].path
|
93
|
-
end
|
94
|
-
end
|