petstroepack 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +86 -0
- data/lib/ctd_documentation/api_helper.rb +10 -0
- data/lib/ctd_documentation/client.rb +140 -0
- data/lib/ctd_documentation/configuration.rb +103 -0
- data/lib/ctd_documentation/controllers/activities_controller.rb +69 -0
- data/lib/ctd_documentation/controllers/alerts_controller.rb +170 -0
- data/lib/ctd_documentation/controllers/assets_controller.rb +409 -0
- data/lib/ctd_documentation/controllers/base_controller.rb +65 -0
- data/lib/ctd_documentation/controllers/custom_attributes_categories_controller.rb +50 -0
- data/lib/ctd_documentation/controllers/events_controller.rb +67 -0
- data/lib/ctd_documentation/controllers/groups_controller.rb +28 -0
- data/lib/ctd_documentation/controllers/insights_controller.rb +111 -0
- data/lib/ctd_documentation/controllers/license_controller.rb +73 -0
- data/lib/ctd_documentation/controllers/login_controller.rb +31 -0
- data/lib/ctd_documentation/controllers/queries_controller.rb +128 -0
- data/lib/ctd_documentation/controllers/sensors_controller.rb +26 -0
- data/lib/ctd_documentation/controllers/sites_controller.rb +39 -0
- data/lib/ctd_documentation/controllers/tasks_controller.rb +148 -0
- data/lib/ctd_documentation/controllers/tasks_queries_controller.rb +29 -0
- data/lib/ctd_documentation/controllers/users_controller.rb +28 -0
- data/lib/ctd_documentation/exceptions/api_exception.rb +10 -0
- data/lib/ctd_documentation/exceptions/auth_authenticate401_error_exception.rb +48 -0
- data/lib/ctd_documentation/http/auth/custom_header_auth.rb +25 -0
- data/lib/ctd_documentation/http/http_call_back.rb +10 -0
- data/lib/ctd_documentation/http/http_method_enum.rb +10 -0
- data/lib/ctd_documentation/http/http_request.rb +10 -0
- data/lib/ctd_documentation/http/http_response.rb +10 -0
- data/lib/ctd_documentation/models/actionable.rb +70 -0
- data/lib/ctd_documentation/models/actionable_asset.rb +80 -0
- data/lib/ctd_documentation/models/actionable_cap.rb +80 -0
- data/lib/ctd_documentation/models/actionable_information.rb +80 -0
- data/lib/ctd_documentation/models/actionable_policy.rb +361 -0
- data/lib/ctd_documentation/models/actionable_related_asset.rb +142 -0
- data/lib/ctd_documentation/models/active_history.rb +311 -0
- data/lib/ctd_documentation/models/activities_object.rb +150 -0
- data/lib/ctd_documentation/models/activities_response.rb +100 -0
- data/lib/ctd_documentation/models/activity.rb +150 -0
- data/lib/ctd_documentation/models/add_license_response.rb +79 -0
- data/lib/ctd_documentation/models/alert.rb +455 -0
- data/lib/ctd_documentation/models/alert_severity_enum.rb +23 -0
- data/lib/ctd_documentation/models/asset.rb +527 -0
- data/lib/ctd_documentation/models/assets_with_insights.rb +252 -0
- data/lib/ctd_documentation/models/assets_with_insights_response.rb +90 -0
- data/lib/ctd_documentation/models/authenticate.rb +57 -0
- data/lib/ctd_documentation/models/base_model.rb +58 -0
- data/lib/ctd_documentation/models/base_task.rb +198 -0
- data/lib/ctd_documentation/models/cap.rb +90 -0
- data/lib/ctd_documentation/models/code_sections.rb +70 -0
- data/lib/ctd_documentation/models/content_type_enum.rb +14 -0
- data/lib/ctd_documentation/models/create_a_new_query.rb +57 -0
- data/lib/ctd_documentation/models/create_a_new_query_response.rb +57 -0
- data/lib/ctd_documentation/models/create_group_response.rb +48 -0
- data/lib/ctd_documentation/models/create_user_response.rb +48 -0
- data/lib/ctd_documentation/models/createanewtask.rb +57 -0
- data/lib/ctd_documentation/models/createanewtask_response.rb +57 -0
- data/lib/ctd_documentation/models/ctd_login_exception.rb +81 -0
- data/lib/ctd_documentation/models/ctd_login_response.rb +101 -0
- data/lib/ctd_documentation/models/custom_attribute_category.rb +90 -0
- data/lib/ctd_documentation/models/db_statistics.rb +50 -0
- data/lib/ctd_documentation/models/delete_a_query_response.rb +48 -0
- data/lib/ctd_documentation/models/delete_a_task_response.rb +48 -0
- data/lib/ctd_documentation/models/destination_virtual_zone.rb +60 -0
- data/lib/ctd_documentation/models/detail.rb +60 -0
- data/lib/ctd_documentation/models/discovery_params.rb +82 -0
- data/lib/ctd_documentation/models/entity.rb +70 -0
- data/lib/ctd_documentation/models/event.rb +175 -0
- data/lib/ctd_documentation/models/find_asset_by_id_response.rb +547 -0
- data/lib/ctd_documentation/models/format1_enum.rb +22 -0
- data/lib/ctd_documentation/models/format_enum.rb +20 -0
- data/lib/ctd_documentation/models/get_active_detection_history_response.rb +90 -0
- data/lib/ctd_documentation/models/get_alerts_response.rb +90 -0
- data/lib/ctd_documentation/models/get_all_sites_response.rb +90 -0
- data/lib/ctd_documentation/models/get_assets_response.rb +90 -0
- data/lib/ctd_documentation/models/get_custom_attribute_categories_response.rb +90 -0
- data/lib/ctd_documentation/models/get_events_response.rb +90 -0
- data/lib/ctd_documentation/models/get_license_details_response.rb +81 -0
- data/lib/ctd_documentation/models/get_queries_ids_and_assigned_task_response.rb +70 -0
- data/lib/ctd_documentation/models/get_queries_response.rb +90 -0
- data/lib/ctd_documentation/models/get_tasks_response.rb +90 -0
- data/lib/ctd_documentation/models/get_types_response.rb +57 -0
- data/lib/ctd_documentation/models/group.rb +73 -0
- data/lib/ctd_documentation/models/identifiable.rb +70 -0
- data/lib/ctd_documentation/models/indicator_info.rb +90 -0
- data/lib/ctd_documentation/models/indicators.rb +122 -0
- data/lib/ctd_documentation/models/information.rb +183 -0
- data/lib/ctd_documentation/models/insight_status_enum.rb +20 -0
- data/lib/ctd_documentation/models/insight_status_exact1_enum.rb +21 -0
- data/lib/ctd_documentation/models/insight_status_exact_enum.rb +20 -0
- data/lib/ctd_documentation/models/license_request.rb +48 -0
- data/lib/ctd_documentation/models/network.rb +80 -0
- data/lib/ctd_documentation/models/new_queryobject.rb +199 -0
- data/lib/ctd_documentation/models/new_taskobject.rb +199 -0
- data/lib/ctd_documentation/models/object.rb +70 -0
- data/lib/ctd_documentation/models/paginated_response.rb +71 -0
- data/lib/ctd_documentation/models/policy.rb +331 -0
- data/lib/ctd_documentation/models/queryextraparams.rb +60 -0
- data/lib/ctd_documentation/models/ranger_system_check_response.rb +57 -0
- data/lib/ctd_documentation/models/risk_vector.rb +89 -0
- data/lib/ctd_documentation/models/selection_params.rb +58 -0
- data/lib/ctd_documentation/models/selection_params1.rb +80 -0
- data/lib/ctd_documentation/models/site.rb +256 -0
- data/lib/ctd_documentation/models/site_list_slim_enum.rb +14 -0
- data/lib/ctd_documentation/models/slim_insight.rb +139 -0
- data/lib/ctd_documentation/models/sort1_enum.rb +65 -0
- data/lib/ctd_documentation/models/sort31_enum.rb +59 -0
- data/lib/ctd_documentation/models/sort3_enum.rb +59 -0
- data/lib/ctd_documentation/models/sort41_enum.rb +41 -0
- data/lib/ctd_documentation/models/sort4_enum.rb +41 -0
- data/lib/ctd_documentation/models/sort5_enum.rb +35 -0
- data/lib/ctd_documentation/models/sort6_enum.rb +41 -0
- data/lib/ctd_documentation/models/sort_enum.rb +125 -0
- data/lib/ctd_documentation/models/source_virtual_zone.rb +60 -0
- data/lib/ctd_documentation/models/special_hint_enum.rb +26 -0
- data/lib/ctd_documentation/models/special_hint_exact_enum.rb +26 -0
- data/lib/ctd_documentation/models/status_enum.rb +17 -0
- data/lib/ctd_documentation/models/status_exact_enum.rb +23 -0
- data/lib/ctd_documentation/models/subnet.rb +50 -0
- data/lib/ctd_documentation/models/task.rb +281 -0
- data/lib/ctd_documentation/models/taskextraparams.rb +71 -0
- data/lib/ctd_documentation/models/update_a_single_query_response.rb +57 -0
- data/lib/ctd_documentation/models/update_a_single_task_response.rb +57 -0
- data/lib/ctd_documentation/models/update_license_response.rb +79 -0
- data/lib/ctd_documentation/models/user.rb +88 -0
- data/lib/ctd_documentation/models/virtual_zones.rb +118 -0
- data/lib/ctd_documentation/utilities/date_time_helper.rb +11 -0
- data/lib/ctd_documentation/utilities/file_wrapper.rb +16 -0
- data/lib/ctd_documentation.rb +155 -0
- data/test/controllers/controller_test_base.rb +29 -0
- data/test/controllers/test_activities_controller.rb +64 -0
- data/test/controllers/test_alerts_controller.rb +16 -0
- data/test/controllers/test_assets_controller.rb +79 -0
- data/test/controllers/test_custom_attributes_categories_controller.rb +52 -0
- data/test/controllers/test_events_controller.rb +55 -0
- data/test/controllers/test_login_controller.rb +45 -0
- data/test/controllers/test_queries_controller.rb +292 -0
- data/test/controllers/test_sites_controller.rb +53 -0
- data/test/controllers/test_tasks_controller.rb +250 -0
- data/test/http_response_catcher.rb +19 -0
- metadata +259 -0
@@ -0,0 +1,292 @@
|
|
1
|
+
# ctd_documentation
|
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 QueriesControllerTests < ControllerTestBase
|
9
|
+
# Called only once for the class before any test has executed
|
10
|
+
def setup
|
11
|
+
setup_class
|
12
|
+
@controller = @client.queries
|
13
|
+
@response_catcher = @controller.http_call_back
|
14
|
+
end
|
15
|
+
|
16
|
+
# Get all queries and their information
|
17
|
+
def test_get_queries()
|
18
|
+
# Parameters for the API call
|
19
|
+
sort = nil
|
20
|
+
page = nil
|
21
|
+
per_page = nil
|
22
|
+
name__icontains = nil
|
23
|
+
site_id__exact = nil
|
24
|
+
|
25
|
+
# Perform the API call through the SDK function
|
26
|
+
result = @controller.get_queries(sort: sort, page: page, per_page: per_page, name__icontains: name__icontains, site_id__exact: site_id__exact)
|
27
|
+
|
28
|
+
# Test response code
|
29
|
+
assert_equal(200, @response_catcher.response.status_code)
|
30
|
+
|
31
|
+
# Test headers
|
32
|
+
expected_headers = {}
|
33
|
+
expected_headers['content-type'] = 'text/plain'
|
34
|
+
|
35
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
36
|
+
|
37
|
+
# Test whether the captured response is as we expected
|
38
|
+
refute_nil(result)
|
39
|
+
expected_body = JSON.parse(
|
40
|
+
'{"count_filtered":40,"count_total":40,"count_in_page":10,"objects":[{"a'\
|
41
|
+
'llowed_days":"24","allowed_run_time_end":"07:00","allowed_run_time_star'\
|
42
|
+
't":"17:00","type":27,"end_time":"2021-07-06T00:00:00+00:00","interval":'\
|
43
|
+
'"604800","is_recurring":true,"name":"my task","resource_id":"1-1","site'\
|
44
|
+
'_id":1,"status":"Scheduled","valid":true,"start_time":"2020-07-06T00:00'\
|
45
|
+
':00+00:00","assets_count":0,"extra_params":{"Query_Discovered_Devices":'\
|
46
|
+
'true,"port":47808,"sub_query":"Broadcast"},"enabled":true,"id":"1","las'\
|
47
|
+
't_start_run_time":"2020-07-06T00:00:00+00:00","network_id":1,"active_ty'\
|
48
|
+
'pe":2}]}'
|
49
|
+
)
|
50
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
51
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
52
|
+
end
|
53
|
+
|
54
|
+
# Get descriptions and enums for all queries (can be used later to retrieve parameters per task type enum)
|
55
|
+
def test_get_information_for_all_queries()
|
56
|
+
|
57
|
+
# Perform the API call through the SDK function
|
58
|
+
result = @controller.get_information_for_all_queries()
|
59
|
+
|
60
|
+
# Test response code
|
61
|
+
assert_equal(200, @response_catcher.response.status_code)
|
62
|
+
|
63
|
+
# Test headers
|
64
|
+
expected_headers = {}
|
65
|
+
expected_headers['content-type'] = 'application/json'
|
66
|
+
|
67
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
68
|
+
|
69
|
+
# Test whether the captured response is as we expected
|
70
|
+
refute_nil(result)
|
71
|
+
expected_body = JSON.parse(
|
72
|
+
'{"1":{"name":"SNMP Query","description":"Simple Network Management Prot'\
|
73
|
+
'ocol (SNMP) is an Internet Standard protocol for collecting and organiz'\
|
74
|
+
'ing information about managed devices on IP networks and for modifying '\
|
75
|
+
'that information to change device behavior. Devices that typically supp'\
|
76
|
+
'ort SNMP include cable modems, routers, switches, servers, workstations'\
|
77
|
+
', printers, and more.","is_simple_query":false},"3":{"name":"Banner Gra'\
|
78
|
+
'bbing Query","description":"Generic Banner Grabbing Query. Connects via'\
|
79
|
+
' TCP to the specified port and extracts info based on provided regexes"'\
|
80
|
+
',"is_simple_query":false}}'
|
81
|
+
)
|
82
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
83
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
84
|
+
end
|
85
|
+
|
86
|
+
# This is used to determine the payload needed to be sent for creating/updating a query by a certain query type enum value
|
87
|
+
def test_all_queries_fields_types_and_validations()
|
88
|
+
|
89
|
+
# Perform the API call through the SDK function
|
90
|
+
result = @controller.all_queries_fields_types_and_validations()
|
91
|
+
|
92
|
+
# Test response code
|
93
|
+
assert_equal(200, @response_catcher.response.status_code)
|
94
|
+
|
95
|
+
# Test headers
|
96
|
+
expected_headers = {}
|
97
|
+
expected_headers['content-type'] = 'application/json'
|
98
|
+
|
99
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
100
|
+
|
101
|
+
# Test whether the captured response is as we expected
|
102
|
+
refute_nil(result)
|
103
|
+
expected_body = JSON.parse(
|
104
|
+
'{"1":{"param_keys":{"sub_query":{"v1":[{"name":"port","param_type":"num'\
|
105
|
+
'ber","placeholder":"Any number in 1-65535","type_params":{"min":1,"max"'\
|
106
|
+
':65535},"default_value":161,"param_level":"advanced","validators":["^(['\
|
107
|
+
'1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|'\
|
108
|
+
'9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-'\
|
109
|
+
'4][0-9]{2}|655[0-2][0-9]|6553[0-5])$"]},{"name":"ip_range","param_type"'\
|
110
|
+
':"textarea","placeholder":"Range of IPs (192.168.1.1-192.168.1.255)","v'\
|
111
|
+
'alidators":["(\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}'\
|
112
|
+
'(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b-\\\\b(?:(?:25[0-5]|2[0-4]'\
|
113
|
+
'[0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?'\
|
114
|
+
')\\\\b|\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0'\
|
115
|
+
'-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b(\\\\/([0-9]|[1-2][0-9]|3[0-2])'\
|
116
|
+
'\\\\b)?|\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25['\
|
117
|
+
'0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b),*","(\\\\b([0-9a-fA-F]{1,4}:){'\
|
118
|
+
'7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}'\
|
119
|
+
':[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-'\
|
120
|
+
'9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:'\
|
121
|
+
'[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}'\
|
122
|
+
'|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}'\
|
123
|
+
'|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}'\
|
124
|
+
':){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\\\.){3,3}(25[0-5]|(2['\
|
125
|
+
'0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]'\
|
126
|
+
'|1{0,1}[0-9]){0,1}[0-9])\\\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0'\
|
127
|
+
'-9])\\\\b-*)","\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3'\
|
128
|
+
'}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b(\\\\/([0-9]|[1-2][0-9]|3'\
|
129
|
+
'[0-2])\\\\b)?"]},{"name":"ip_range_exclude","param_type":"textarea","pl'\
|
130
|
+
'aceholder":"Exclude range of IPs (192.168.1.1-192.168.1.255)","validato'\
|
131
|
+
'rs":["(\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0'\
|
132
|
+
'-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b-\\\\b(?:(?:25[0-5]|2[0-4][0-9]|['\
|
133
|
+
'01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b|'\
|
134
|
+
'\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0'\
|
135
|
+
'-4][0-9]|[01]?[0-9][0-9]?)\\\\b(\\\\/([0-9]|[1-2][0-9]|3[0-2])\\\\b)?|'\
|
136
|
+
'\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0'\
|
137
|
+
'-4][0-9]|[01]?[0-9][0-9]?)\\\\b),*","(\\\\b([0-9a-fA-F]{1,4}:){7,7}[0-9'\
|
138
|
+
'a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-f'\
|
139
|
+
'A-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]'\
|
140
|
+
'{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA'\
|
141
|
+
'-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-f'\
|
142
|
+
'A-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80'\
|
143
|
+
':(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}('\
|
144
|
+
'(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\\\.){3,3}(25[0-5]|(2[0-4]|1{0'\
|
145
|
+
',1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}['\
|
146
|
+
'0-9]){0,1}[0-9])\\\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])'\
|
147
|
+
'\\\\b-*)","\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:'\
|
148
|
+
'25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b(\\\\/([0-9]|[1-2][0-9]|3[0-2'\
|
149
|
+
'])\\\\b)?"]},{"name":"get_cam","param_type":"checkbox","placeholder":""'\
|
150
|
+
',"default_value":false},{"name":"get_baselines","param_type":"checkbox"'\
|
151
|
+
',"placeholder":"","default_value":true},{"name":"community","param_type'\
|
152
|
+
'":"password","placeholder":"","is_required":true},{"name":"get_arp","pa'\
|
153
|
+
'ram_type":"checkbox","placeholder":"","default_value":false}],"v2c":[{"'\
|
154
|
+
'name":"port","param_type":"number","placeholder":"Any number in 1-65535'\
|
155
|
+
'","type_params":{"min":1,"max":65535},"default_value":161,"param_level"'\
|
156
|
+
':"advanced","validators":["^([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-'\
|
157
|
+
'8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-5'\
|
158
|
+
'][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$"]},{'\
|
159
|
+
'"name":"ip_range","param_type":"textarea","placeholder":"Range of IPs ('\
|
160
|
+
'192.168.1.1-192.168.1.255)","validators":["(\\\\b(?:(?:25[0-5]|2[0-4][0'\
|
161
|
+
'-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'\
|
162
|
+
'\\\\b-\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-'\
|
163
|
+
'5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b|\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[0'\
|
164
|
+
'1]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b('\
|
165
|
+
'\\\\/([0-9]|[1-2][0-9]|3[0-2])\\\\b)?|\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[0'\
|
166
|
+
'1]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b),'\
|
167
|
+
'*","(\\\\b([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){'\
|
168
|
+
'1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5'\
|
169
|
+
'}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1'\
|
170
|
+
',3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:'\
|
171
|
+
'){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,'\
|
172
|
+
'6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-z'\
|
173
|
+
'A-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1'\
|
174
|
+
'}[0-9])\\\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]'\
|
175
|
+
'{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\\\.){3,3}(25[0-'\
|
176
|
+
'5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\\\b-*)","\\\\b(?:(?:25[0-5]|2[0-4]['\
|
177
|
+
'0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'\
|
178
|
+
'\\\\b(\\\\/([0-9]|[1-2][0-9]|3[0-2])\\\\b)?"]},{"name":"ip_range_exclud'\
|
179
|
+
'e","param_type":"textarea","placeholder":"Exclude range of IPs (192.168'\
|
180
|
+
'.1.1-192.168.1.255)","validators":["(\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01'\
|
181
|
+
']?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b-'\
|
182
|
+
'\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0'\
|
183
|
+
'-4][0-9]|[01]?[0-9][0-9]?)\\\\b|\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-'\
|
184
|
+
'9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b(\\\\/(['\
|
185
|
+
'0-9]|[1-2][0-9]|3[0-2])\\\\b)?|\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9'\
|
186
|
+
'][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b),*","('\
|
187
|
+
'\\\\b([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:'\
|
188
|
+
'|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0'\
|
189
|
+
'-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|('\
|
190
|
+
'[0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2'\
|
191
|
+
'}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:'\
|
192
|
+
'((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{'\
|
193
|
+
'1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9'\
|
194
|
+
'])\\\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}'\
|
195
|
+
':){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\\\.){3,3}(25[0-5]|(2'\
|
196
|
+
'[0-4]|1{0,1}[0-9]){0,1}[0-9])\\\\b-*)","\\\\b(?:(?:25[0-5]|2[0-4][0-9]|'\
|
197
|
+
'[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b'\
|
198
|
+
'(\\\\/([0-9]|[1-2][0-9]|3[0-2])\\\\b)?"]},{"name":"get_cam","param_type'\
|
199
|
+
'":"checkbox","placeholder":"","default_value":false},{"name":"get_basel'\
|
200
|
+
'ines","param_type":"checkbox","placeholder":"","default_value":true},{"'\
|
201
|
+
'name":"community","param_type":"password","placeholder":"","is_required'\
|
202
|
+
'":true},{"name":"get_arp","param_type":"checkbox","placeholder":"","def'\
|
203
|
+
'ault_value":false}],"v3":[{"name":"port","param_type":"number","placeho'\
|
204
|
+
'lder":"Any number in 1-65535","type_params":{"min":1,"max":65535},"defa'\
|
205
|
+
'ult_value":161,"param_level":"advanced","validators":["^([1-9]|[1-8][0-'\
|
206
|
+
'9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2'\
|
207
|
+
'}|99[0-8][0-9]|999[0-9]|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|65'\
|
208
|
+
'5[0-2][0-9]|6553[0-5])$"]},{"name":"ip_range","param_type":"textarea","'\
|
209
|
+
'placeholder":"Range of IPs (192.168.1.1-192.168.1.255)","validators":["'\
|
210
|
+
'(\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2['\
|
211
|
+
'0-4][0-9]|[01]?[0-9][0-9]?)\\\\b-\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0'\
|
212
|
+
'-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b|\\\\b('\
|
213
|
+
'?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-'\
|
214
|
+
'9]|[01]?[0-9][0-9]?)\\\\b(\\\\/([0-9]|[1-2][0-9]|3[0-2])\\\\b)?|\\\\b(?'\
|
215
|
+
':(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9'\
|
216
|
+
']|[01]?[0-9][0-9]?)\\\\b),*","(\\\\b([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]'\
|
217
|
+
'{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,'\
|
218
|
+
'4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:)'\
|
219
|
+
'{1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4'\
|
220
|
+
'}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,'\
|
221
|
+
'4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9'\
|
222
|
+
'a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5'\
|
223
|
+
']|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9'\
|
224
|
+
']){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0'\
|
225
|
+
',1}[0-9])\\\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\\\b-*)","'\
|
226
|
+
'\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0'\
|
227
|
+
'-4][0-9]|[01]?[0-9][0-9]?)\\\\b(\\\\/([0-9]|[1-2][0-9]|3[0-2])\\\\b)?"]'\
|
228
|
+
'},{"name":"ip_range_exclude","param_type":"textarea","placeholder":"Exc'\
|
229
|
+
'lude range of IPs (192.168.1.1-192.168.1.255)","validators":["(\\\\b(?:'\
|
230
|
+
'(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]'\
|
231
|
+
'|[01]?[0-9][0-9]?)\\\\b-\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?'\
|
232
|
+
')\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b|\\\\b(?:(?:25[0'\
|
233
|
+
'-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?['\
|
234
|
+
'0-9][0-9]?)\\\\b(\\\\/([0-9]|[1-2][0-9]|3[0-2])\\\\b)?|\\\\b(?:(?:25[0-'\
|
235
|
+
'5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0'\
|
236
|
+
'-9][0-9]?)\\\\b),*","(\\\\b([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0'\
|
237
|
+
'-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a'\
|
238
|
+
'-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0'\
|
239
|
+
'-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|('\
|
240
|
+
'[0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-'\
|
241
|
+
'9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0'\
|
242
|
+
',4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]'\
|
243
|
+
'|1{0,1}[0-9]){0,1}[0-9])\\\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0'\
|
244
|
+
'-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])'\
|
245
|
+
'\\\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\\\b-*)","\\\\b(?:('\
|
246
|
+
'?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|'\
|
247
|
+
'[01]?[0-9][0-9]?)\\\\b(\\\\/([0-9]|[1-2][0-9]|3[0-2])\\\\b)?"]},{"name"'\
|
248
|
+
':"get_cam","param_type":"checkbox","placeholder":"","default_value":fal'\
|
249
|
+
'se},{"name":"get_baselines","param_type":"checkbox","placeholder":"","d'\
|
250
|
+
'efault_value":true},{"name":"username","param_type":"text","placeholder'\
|
251
|
+
'":"","is_required":true},{"name":"auth_proto","param_type":"dropdown","'\
|
252
|
+
'placeholder":"","type_params":{"dropdownKeys":["No Auth","Default (md5)'\
|
253
|
+
'","sha","sha224","sha256","sha384","sha512"]},"default_value":"Default '\
|
254
|
+
'(md5)"},{"name":"priv_proto","param_type":"dropdown","placeholder":"","'\
|
255
|
+
'type_params":{"dropdownKeys":["No Priv","Default (des)","3des","aes","a'\
|
256
|
+
'es128","aes192","aes256","aesBlumenthal192","aesBlumenthal256"]},"defau'\
|
257
|
+
'lt_value":"Default (des)"},{"name":"auth_key","param_type":"password","'\
|
258
|
+
'placeholder":""},{"name":"priv_key","param_type":"password","placeholde'\
|
259
|
+
'r":""},{"name":"get_arp","param_type":"checkbox","placeholder":"","defa'\
|
260
|
+
'ult_value":false}]}},"target_params":[{"name":"ip_address","param_type"'\
|
261
|
+
':"text","placeholder":"IPv4/6 (e.g. 192.168.1.1)","is_required":true,"v'\
|
262
|
+
'alidators":["\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}('\
|
263
|
+
'?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b","\\\\b([0-9a-fA-F]{1,4}:)'\
|
264
|
+
'{7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6'\
|
265
|
+
'}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0'\
|
266
|
+
'-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}('\
|
267
|
+
':[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5'\
|
268
|
+
'}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7'\
|
269
|
+
'}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1'\
|
270
|
+
'}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\\\.){3,3}(25[0-5]|(2'\
|
271
|
+
'[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4'\
|
272
|
+
']|1{0,1}[0-9]){0,1}[0-9])\\\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}['\
|
273
|
+
'0-9])\\\\b"]}]},"3":{"param_keys":{"sub_query":{"Generic":[]}},"target_'\
|
274
|
+
'params":[{"name":"ip_address","param_type":"text","placeholder":"IPv4/6'\
|
275
|
+
' (e.g. 192.168.1.1)","is_required":true,"validators":["\\\\b(?:(?:25[0-'\
|
276
|
+
'5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0'\
|
277
|
+
'-9][0-9]?)\\\\b","\\\\b([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-'\
|
278
|
+
'fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-'\
|
279
|
+
'F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-'\
|
280
|
+
'fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9'\
|
281
|
+
'a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-f'\
|
282
|
+
'A-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4})'\
|
283
|
+
'{0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0'\
|
284
|
+
',1}[0-9]){0,1}[0-9])\\\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])'\
|
285
|
+
'|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])'\
|
286
|
+
'\\\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\\\b"]}]}}'
|
287
|
+
)
|
288
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
289
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
290
|
+
end
|
291
|
+
|
292
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# ctd_documentation
|
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 SitesControllerTests < ControllerTestBase
|
9
|
+
# Called only once for the class before any test has executed
|
10
|
+
def setup
|
11
|
+
setup_class
|
12
|
+
@controller = @client.sites
|
13
|
+
@response_catcher = @controller.http_call_back
|
14
|
+
end
|
15
|
+
|
16
|
+
# Get all sites and their information
|
17
|
+
def test_get_all_sites()
|
18
|
+
# Parameters for the API call
|
19
|
+
rid__exact = nil
|
20
|
+
sort = nil
|
21
|
+
format = nil
|
22
|
+
page = 1
|
23
|
+
per_page = 20
|
24
|
+
|
25
|
+
# Perform the API call through the SDK function
|
26
|
+
result = @controller.get_all_sites(rid__exact: rid__exact, sort: sort, format: format, page: page, per_page: per_page)
|
27
|
+
|
28
|
+
# Test response code
|
29
|
+
assert_equal(200, @response_catcher.response.status_code)
|
30
|
+
|
31
|
+
# Test headers
|
32
|
+
expected_headers = {}
|
33
|
+
expected_headers['content-type'] = 'application/json'
|
34
|
+
|
35
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
36
|
+
|
37
|
+
# Test whether the captured response is as we expected
|
38
|
+
refute_nil(result)
|
39
|
+
expected_body = JSON.parse(
|
40
|
+
'{"count_filtered":40,"count_total":40,"count_in_page":10,"objects":[{"a'\
|
41
|
+
'ddress":"","assets_count":0,"auto_transition_to_operational":true,"desc'\
|
42
|
+
'ription":"","id":1,"image_url":"","installed_date":"2020-07-06T14:27:20'\
|
43
|
+
'+00:00","integrity_alerts_severity":0,"integrity_alerts_severity__":"eL'\
|
44
|
+
'ow","is_connected":true,"name":"Default","score":100,"security_alerts_s'\
|
45
|
+
'everity":0,"security_alerts_severity__":"eLow","training_mode":true,"un'\
|
46
|
+
'resolved_integrity_alerts_count":0,"unresolved_security_alerts_count":0'\
|
47
|
+
',"version":"3.5.0.0"}]}'
|
48
|
+
)
|
49
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
50
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
@@ -0,0 +1,250 @@
|
|
1
|
+
# ctd_documentation
|
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 TasksControllerTests < ControllerTestBase
|
9
|
+
# Called only once for the class before any test has executed
|
10
|
+
def setup
|
11
|
+
setup_class
|
12
|
+
@controller = @client.tasks
|
13
|
+
@response_catcher = @controller.http_call_back
|
14
|
+
end
|
15
|
+
|
16
|
+
# Get all tasks and their information
|
17
|
+
def test_get_tasks()
|
18
|
+
# Parameters for the API call
|
19
|
+
sort = nil
|
20
|
+
page = 1
|
21
|
+
per_page = 20
|
22
|
+
name__icontains = nil
|
23
|
+
site_id__exact = nil
|
24
|
+
|
25
|
+
# Perform the API call through the SDK function
|
26
|
+
result = @controller.get_tasks(sort: sort, page: page, per_page: per_page, name__icontains: name__icontains, site_id__exact: site_id__exact)
|
27
|
+
|
28
|
+
# Test response code
|
29
|
+
assert_equal(200, @response_catcher.response.status_code)
|
30
|
+
|
31
|
+
# Test headers
|
32
|
+
expected_headers = {}
|
33
|
+
expected_headers['content-type'] = 'text/plain'
|
34
|
+
|
35
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
36
|
+
|
37
|
+
# Test whether the captured response is as we expected
|
38
|
+
refute_nil(result)
|
39
|
+
expected_body = JSON.parse(
|
40
|
+
'{"count_filtered":40,"count_total":40,"count_in_page":10,"objects":[{"a'\
|
41
|
+
'llowed_days":"24","allowed_run_time_end":"07:00","allowed_run_time_star'\
|
42
|
+
't":"17:00","type":27,"end_time":"2021-07-06T00:00:00+00:00","interval":'\
|
43
|
+
'"604800","is_recurring":true,"name":"my task","resource_id":"1-1","site'\
|
44
|
+
'_id":1,"status":"Scheduled","valid":true,"start_time":"2020-07-06T00:00'\
|
45
|
+
':00+00:00","assets_count":0,"extra_params":{"Query_Discovered_Devices":'\
|
46
|
+
'true,"port":47808,"sub_query":"Broadcast"},"enabled":true,"id":"1","las'\
|
47
|
+
't_start_run_time":"2020-07-06T00:00:00+00:00","network_id":1,"active_ty'\
|
48
|
+
'pe":2}]}'
|
49
|
+
)
|
50
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
51
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
52
|
+
end
|
53
|
+
|
54
|
+
# This route creates a task
|
55
|
+
def test_create_a_new_task()
|
56
|
+
# Parameters for the API call
|
57
|
+
body = Createanewtask.from_hash(APIHelper.json_deserialize(
|
58
|
+
'{"site_id":1,"params":{"allowed_days":"24","allowed_run_time_end":"07:0'\
|
59
|
+
'0","allowed_run_time_start":"17:00","start_time":"2020-07-06T00:00:00+0'\
|
60
|
+
'0:00","end_time":"2021-07-06T00:00:00+00:00","attached_queries":[1],"en'\
|
61
|
+
'abled":true,"interval":"604800","is_recurring":true,"name":"Factory Dis'\
|
62
|
+
'covery","network_id":1,"type":27,"extra_params":{"sub_query":"Broadcast'\
|
63
|
+
'","port":47808,"Query_Discovered_Devices":true}}}', false))
|
64
|
+
|
65
|
+
# Perform the API call through the SDK function
|
66
|
+
result = @controller.create_a_new_task(body)
|
67
|
+
|
68
|
+
# Test response code
|
69
|
+
assert_equal(200, @response_catcher.response.status_code)
|
70
|
+
|
71
|
+
# Test headers
|
72
|
+
expected_headers = {}
|
73
|
+
expected_headers['content-type'] = 'application/json'
|
74
|
+
|
75
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
76
|
+
|
77
|
+
# Test whether the captured response is as we expected
|
78
|
+
refute_nil(result)
|
79
|
+
expected_body = JSON.parse(
|
80
|
+
'{"success":true,"data":"Saved task Factory Discovery"}'
|
81
|
+
)
|
82
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
83
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
84
|
+
end
|
85
|
+
|
86
|
+
# Get descriptions and enums for all tasks (can be used later to retrieve parameters per task type enum)
|
87
|
+
def test_information_of_all_tasks()
|
88
|
+
|
89
|
+
# Perform the API call through the SDK function
|
90
|
+
result = @controller.information_of_all_tasks()
|
91
|
+
|
92
|
+
# Test response code
|
93
|
+
assert_equal(200, @response_catcher.response.status_code)
|
94
|
+
|
95
|
+
# Test headers
|
96
|
+
expected_headers = {}
|
97
|
+
expected_headers['content-type'] = 'application/json'
|
98
|
+
|
99
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
100
|
+
|
101
|
+
# Test whether the captured response is as we expected
|
102
|
+
refute_nil(result)
|
103
|
+
expected_body = JSON.parse(
|
104
|
+
'{"7":{"name":"Ping Sweep","description":"The Internet Control Message P'\
|
105
|
+
'rotocol (ICMP) is a supporting protocol in the Internet protocol suite.'\
|
106
|
+
' It is used by network devices, including routers, to send error messag'\
|
107
|
+
'es and operational information indicating, for example, that a requeste'\
|
108
|
+
'd service is not available or that a host or router could not be reache'\
|
109
|
+
'd.","is_simple_query":false},"9":{"name":"HiDiscovery Discovery","descr'\
|
110
|
+
'iption":"Hirschmann discovery protocol.","is_simple_query":false}}'
|
111
|
+
)
|
112
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
113
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
114
|
+
end
|
115
|
+
|
116
|
+
# This is used to determine the payload needed to be sent for creating/updating a task by a certain task type enum value
|
117
|
+
def test_all_tasks_fields()
|
118
|
+
|
119
|
+
# Perform the API call through the SDK function
|
120
|
+
result = @controller.all_tasks_fields()
|
121
|
+
|
122
|
+
# Test response code
|
123
|
+
assert_equal(200, @response_catcher.response.status_code)
|
124
|
+
|
125
|
+
# Test headers
|
126
|
+
expected_headers = {}
|
127
|
+
expected_headers['content-type'] = 'application/json'
|
128
|
+
|
129
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
130
|
+
|
131
|
+
# Test whether the captured response is as we expected
|
132
|
+
refute_nil(result)
|
133
|
+
expected_body = JSON.parse(
|
134
|
+
'{"7":{"param_keys":{"sub_query":{"Generic":[{"name":"ip_range","param_t'\
|
135
|
+
'ype":"textarea","placeholder":"Range of IPs (192.168.1.1-192.168.1.255)'\
|
136
|
+
'","is_required":true,"validators":["(\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01'\
|
137
|
+
']?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b-'\
|
138
|
+
'\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0'\
|
139
|
+
'-4][0-9]|[01]?[0-9][0-9]?)\\\\b|\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-'\
|
140
|
+
'9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b(\\\\/(['\
|
141
|
+
'0-9]|[1-2][0-9]|3[0-2])\\\\b)?|\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9'\
|
142
|
+
'][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b),*","('\
|
143
|
+
'\\\\b([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:'\
|
144
|
+
'|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0'\
|
145
|
+
'-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|('\
|
146
|
+
'[0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2'\
|
147
|
+
'}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:'\
|
148
|
+
'((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{'\
|
149
|
+
'1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9'\
|
150
|
+
'])\\\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}'\
|
151
|
+
':){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\\\.){3,3}(25[0-5]|(2'\
|
152
|
+
'[0-4]|1{0,1}[0-9]){0,1}[0-9])\\\\b-*)","\\\\b(?:(?:25[0-5]|2[0-4][0-9]|'\
|
153
|
+
'[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b'\
|
154
|
+
'(\\\\/([0-9]|[1-2][0-9]|3[0-2])\\\\b)?"]},{"name":"ip_range_exclude","p'\
|
155
|
+
'aram_type":"textarea","placeholder":"Exclude range of IPs (192.168.1.1-'\
|
156
|
+
'192.168.1.255)","validators":["(\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-'\
|
157
|
+
'9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b-\\\\b(?'\
|
158
|
+
':(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9'\
|
159
|
+
']|[01]?[0-9][0-9]?)\\\\b|\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]'\
|
160
|
+
'?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b(\\\\/([0-9]|[1'\
|
161
|
+
'-2][0-9]|3[0-2])\\\\b)?|\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?'\
|
162
|
+
')\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b),*","(\\\\b([0-'\
|
163
|
+
'9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-f'\
|
164
|
+
'A-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]'\
|
165
|
+
'{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-'\
|
166
|
+
'F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-'\
|
167
|
+
'fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-'\
|
168
|
+
'fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ff'\
|
169
|
+
'ff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\\\.){'\
|
170
|
+
'3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:('\
|
171
|
+
'(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\\\.){3,3}(25[0-5]|(2[0-4]|1{0'\
|
172
|
+
',1}[0-9]){0,1}[0-9])\\\\b-*)","\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9'\
|
173
|
+
'][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b(\\\\/([0'\
|
174
|
+
'-9]|[1-2][0-9]|3[0-2])\\\\b)?"]},{"name":"custom_label","param_type":"t'\
|
175
|
+
'ext","placeholder":"Key1:Val1","validators":["\\\\w+:\\\\w+,*"]},{"name'\
|
176
|
+
'":"concurrent_scans","param_type":"number","placeholder":"","type_param'\
|
177
|
+
's":{"min":1,"max":255},"default_value":50,"validators":["^\\\\d*\\\\.?'\
|
178
|
+
'\\\\d*$"]},{"name":"retranmissions","param_type":"number","placeholder"'\
|
179
|
+
':"","type_params":{"min":1,"max":100},"default_value":2,"validators":["'\
|
180
|
+
'^\\\\d*\\\\.?\\\\d*$"]}],"Host Name Resolving":[{"name":"ip_range","par'\
|
181
|
+
'am_type":"textarea","placeholder":"Range of IPs (192.168.1.1-192.168.1.'\
|
182
|
+
'255)","is_required":true,"validators":["(\\\\b(?:(?:25[0-5]|2[0-4][0-9]'\
|
183
|
+
'|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'\
|
184
|
+
'\\\\b-\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-'\
|
185
|
+
'5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b|\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[0'\
|
186
|
+
'1]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b('\
|
187
|
+
'\\\\/([0-9]|[1-2][0-9]|3[0-2])\\\\b)?|\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[0'\
|
188
|
+
'1]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b),'\
|
189
|
+
'*","(\\\\b([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){'\
|
190
|
+
'1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5'\
|
191
|
+
'}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1'\
|
192
|
+
',3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:'\
|
193
|
+
'){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,'\
|
194
|
+
'6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-z'\
|
195
|
+
'A-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1'\
|
196
|
+
'}[0-9])\\\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]'\
|
197
|
+
'{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\\\.){3,3}(25[0-'\
|
198
|
+
'5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\\\b-*)","\\\\b(?:(?:25[0-5]|2[0-4]['\
|
199
|
+
'0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'\
|
200
|
+
'\\\\b(\\\\/([0-9]|[1-2][0-9]|3[0-2])\\\\b)?"]},{"name":"ip_range_exclud'\
|
201
|
+
'e","param_type":"textarea","placeholder":"Exclude range of IPs (192.168'\
|
202
|
+
'.1.1-192.168.1.255)","validators":["(\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01'\
|
203
|
+
']?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b-'\
|
204
|
+
'\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0'\
|
205
|
+
'-4][0-9]|[01]?[0-9][0-9]?)\\\\b|\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-'\
|
206
|
+
'9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b(\\\\/(['\
|
207
|
+
'0-9]|[1-2][0-9]|3[0-2])\\\\b)?|\\\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9'\
|
208
|
+
'][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b),*","('\
|
209
|
+
'\\\\b([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:'\
|
210
|
+
'|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0'\
|
211
|
+
'-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|('\
|
212
|
+
'[0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2'\
|
213
|
+
'}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:'\
|
214
|
+
'((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{'\
|
215
|
+
'1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9'\
|
216
|
+
'])\\\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}'\
|
217
|
+
':){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\\\.){3,3}(25[0-5]|(2'\
|
218
|
+
'[0-4]|1{0,1}[0-9]){0,1}[0-9])\\\\b-*)","\\\\b(?:(?:25[0-5]|2[0-4][0-9]|'\
|
219
|
+
'[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\b'\
|
220
|
+
'(\\\\/([0-9]|[1-2][0-9]|3[0-2])\\\\b)?"]},{"name":"custom_label","param'\
|
221
|
+
'_type":"text","placeholder":"Key1:Val1","validators":["\\\\w+:\\\\w+,*"'\
|
222
|
+
']},{"name":"concurrent_scans","param_type":"number","placeholder":"","t'\
|
223
|
+
'ype_params":{"min":1,"max":255},"default_value":50,"validators":["^'\
|
224
|
+
'\\\\d*\\\\.?\\\\d*$"]},{"name":"retranmissions","param_type":"number","'\
|
225
|
+
'placeholder":"","type_params":{"min":1,"max":100},"default_value":2,"va'\
|
226
|
+
'lidators":["^\\\\d*\\\\.?\\\\d*$"]},{"name":"dns_server","param_type":"'\
|
227
|
+
'text","placeholder":"","default_value":"","validators":["\\\\b(?:(?:25['\
|
228
|
+
'0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?'\
|
229
|
+
'[0-9][0-9]?)\\\\b","\\\\b([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9'\
|
230
|
+
'a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-f'\
|
231
|
+
'A-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9'\
|
232
|
+
'a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0'\
|
233
|
+
'-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a'\
|
234
|
+
'-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4'\
|
235
|
+
'}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1'\
|
236
|
+
'{0,1}[0-9]){0,1}[0-9])\\\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9'\
|
237
|
+
'])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])'\
|
238
|
+
'\\\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\\\b"]},{"name":"do'\
|
239
|
+
'main","param_type":"text","placeholder":"","default_value":""}]}},"targ'\
|
240
|
+
'et_params":[]},"9":{"param_keys":{"sub_query":{"LLC Broadcast":[{"name"'\
|
241
|
+
':"interface_name","param_type":"text","placeholder":"","is_required":tr'\
|
242
|
+
'ue,"is_privileged_required":true},{"name":"custom_label","param_type":"'\
|
243
|
+
'text","placeholder":"Key1:Val1","validators":["\\\\w+:\\\\w+,*"]}]}},"t'\
|
244
|
+
'arget_params":[]}}'
|
245
|
+
)
|
246
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
247
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
248
|
+
end
|
249
|
+
|
250
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# ctd_documentation
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
class HttpResponseCatcher < CtdDocumentation::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
|
+
|