dependency-tracker-client 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/LICENSE +201 -0
- data/README.md +276 -0
- data/Rakefile +10 -0
- data/dependency-tracker-client.gemspec +39 -0
- data/docs/About.md +25 -0
- data/docs/Analysis.md +21 -0
- data/docs/AnalysisApi.md +177 -0
- data/docs/AnalysisComment.md +21 -0
- data/docs/AnalysisRequest.md +27 -0
- data/docs/ApiKey.md +17 -0
- data/docs/BadgeApi.md +102 -0
- data/docs/BodyPart.md +31 -0
- data/docs/BomApi.md +335 -0
- data/docs/BomSubmitRequest.md +25 -0
- data/docs/CalculatorApi.md +61 -0
- data/docs/CloneProjectRequest.md +19 -0
- data/docs/Component.md +69 -0
- data/docs/ComponentApi.md +373 -0
- data/docs/ComponentMetrics.md +43 -0
- data/docs/ConfigProperty.md +25 -0
- data/docs/ConfigPropertyApi.md +167 -0
- data/docs/ContentDisposition.md +29 -0
- data/docs/Cwe.md +19 -0
- data/docs/CweApi.md +110 -0
- data/docs/DefaultApi.md +434 -0
- data/docs/Dependency.md +27 -0
- data/docs/DependencyApi.md +222 -0
- data/docs/DependencyMetrics.md +45 -0
- data/docs/DependencyRequest.md +21 -0
- data/docs/Finding.md +23 -0
- data/docs/FindingApi.md +113 -0
- data/docs/FormDataBodyPart.md +39 -0
- data/docs/FormDataContentDisposition.md +31 -0
- data/docs/FormDataMultiPart.md +35 -0
- data/docs/Framework.md +23 -0
- data/docs/IdentifiableObject.md +17 -0
- data/docs/LdapApi.md +220 -0
- data/docs/LdapUser.md +25 -0
- data/docs/License.md +37 -0
- data/docs/LicenseApi.md +159 -0
- data/docs/ManagedUser.md +37 -0
- data/docs/MappedLdapGroup.md +19 -0
- data/docs/MappedLdapGroupRequest.md +19 -0
- data/docs/MediaType.md +25 -0
- data/docs/MetricsApi.md +922 -0
- data/docs/MultiPart.md +33 -0
- data/docs/NotificationPublisher.md +29 -0
- data/docs/NotificationRule.md +35 -0
- data/docs/PackageURL.md +29 -0
- data/docs/ParameterizedHeader.md +19 -0
- data/docs/Permission.md +19 -0
- data/docs/PermissionApi.md +279 -0
- data/docs/PortfolioMetrics.md +53 -0
- data/docs/Project.md +43 -0
- data/docs/ProjectApi.md +445 -0
- data/docs/ProjectMetrics.md +47 -0
- data/docs/ProjectProperty.md +27 -0
- data/docs/ProjectPropertyApi.md +232 -0
- data/docs/Repository.md +29 -0
- data/docs/RepositoryApi.md +325 -0
- data/docs/RepositoryMetaComponent.md +27 -0
- data/docs/Score.md +23 -0
- data/docs/SearchApi.md +120 -0
- data/docs/SearchResult.md +17 -0
- data/docs/Tag.md +19 -0
- data/docs/Team.md +29 -0
- data/docs/TeamApi.md +432 -0
- data/docs/UserApi.md +715 -0
- data/docs/UserPrincipal.md +27 -0
- data/docs/VersionApi.md +52 -0
- data/docs/Vulnerability.md +69 -0
- data/docs/VulnerabilityApi.md +666 -0
- data/docs/VulnerabilityMetrics.md +23 -0
- data/docs/VulnerableSoftware.md +69 -0
- data/lib/dependency-tracker-client/api/analysis_api.rb +209 -0
- data/lib/dependency-tracker-client/api/badge_api.rb +148 -0
- data/lib/dependency-tracker-client/api/bom_api.rb +382 -0
- data/lib/dependency-tracker-client/api/calculator_api.rb +83 -0
- data/lib/dependency-tracker-client/api/component_api.rb +422 -0
- data/lib/dependency-tracker-client/api/config_property_api.rb +192 -0
- data/lib/dependency-tracker-client/api/cwe_api.rb +136 -0
- data/lib/dependency-tracker-client/api/default_api.rb +491 -0
- data/lib/dependency-tracker-client/api/dependency_api.rb +254 -0
- data/lib/dependency-tracker-client/api/finding_api.rb +140 -0
- data/lib/dependency-tracker-client/api/ldap_api.rb +254 -0
- data/lib/dependency-tracker-client/api/license_api.rb +190 -0
- data/lib/dependency-tracker-client/api/metrics_api.rb +1086 -0
- data/lib/dependency-tracker-client/api/permission_api.rb +342 -0
- data/lib/dependency-tracker-client/api/project_api.rb +504 -0
- data/lib/dependency-tracker-client/api/project_property_api.rb +274 -0
- data/lib/dependency-tracker-client/api/repository_api.rb +376 -0
- data/lib/dependency-tracker-client/api/search_api.rb +143 -0
- data/lib/dependency-tracker-client/api/team_api.rb +486 -0
- data/lib/dependency-tracker-client/api/user_api.rb +796 -0
- data/lib/dependency-tracker-client/api/version_api.rb +78 -0
- data/lib/dependency-tracker-client/api/vulnerability_api.rb +780 -0
- data/lib/dependency-tracker-client/api_client.rb +388 -0
- data/lib/dependency-tracker-client/api_error.rb +57 -0
- data/lib/dependency-tracker-client/configuration.rb +261 -0
- data/lib/dependency-tracker-client/models/about.rb +242 -0
- data/lib/dependency-tracker-client/models/analysis.rb +265 -0
- data/lib/dependency-tracker-client/models/analysis_comment.rb +234 -0
- data/lib/dependency-tracker-client/models/analysis_request.rb +371 -0
- data/lib/dependency-tracker-client/models/api_key.rb +250 -0
- data/lib/dependency-tracker-client/models/body_part.rb +273 -0
- data/lib/dependency-tracker-client/models/bom_submit_request.rb +328 -0
- data/lib/dependency-tracker-client/models/clone_project_request.rb +267 -0
- data/lib/dependency-tracker-client/models/component.rb +900 -0
- data/lib/dependency-tracker-client/models/component_metrics.rb +338 -0
- data/lib/dependency-tracker-client/models/config_property.rb +421 -0
- data/lib/dependency-tracker-client/models/content_disposition.rb +262 -0
- data/lib/dependency-tracker-client/models/cwe.rb +259 -0
- data/lib/dependency-tracker-client/models/dependency.rb +266 -0
- data/lib/dependency-tracker-client/models/dependency_metrics.rb +352 -0
- data/lib/dependency-tracker-client/models/dependency_request.rb +257 -0
- data/lib/dependency-tracker-client/models/finding.rb +239 -0
- data/lib/dependency-tracker-client/models/form_data_body_part.rb +309 -0
- data/lib/dependency-tracker-client/models/form_data_content_disposition.rb +271 -0
- data/lib/dependency-tracker-client/models/form_data_multi_part.rb +295 -0
- data/lib/dependency-tracker-client/models/framework.rb +233 -0
- data/lib/dependency-tracker-client/models/identifiable_object.rb +206 -0
- data/lib/dependency-tracker-client/models/ldap_user.rb +351 -0
- data/lib/dependency-tracker-client/models/license.rb +373 -0
- data/lib/dependency-tracker-client/models/managed_user.rb +480 -0
- data/lib/dependency-tracker-client/models/mapped_ldap_group.rb +255 -0
- data/lib/dependency-tracker-client/models/mapped_ldap_group_request.rb +267 -0
- data/lib/dependency-tracker-client/models/media_type.rb +244 -0
- data/lib/dependency-tracker-client/models/multi_part.rb +284 -0
- data/lib/dependency-tracker-client/models/notification_publisher.rb +388 -0
- data/lib/dependency-tracker-client/models/notification_rule.rb +426 -0
- data/lib/dependency-tracker-client/models/package_url.rb +262 -0
- data/lib/dependency-tracker-client/models/parameterized_header.rb +217 -0
- data/lib/dependency-tracker-client/models/permission.rb +250 -0
- data/lib/dependency-tracker-client/models/portfolio_metrics.rb +378 -0
- data/lib/dependency-tracker-client/models/project.rb +420 -0
- data/lib/dependency-tracker-client/models/project_metrics.rb +356 -0
- data/lib/dependency-tracker-client/models/project_property.rb +430 -0
- data/lib/dependency-tracker-client/models/repository.rb +319 -0
- data/lib/dependency-tracker-client/models/repository_meta_component.rb +305 -0
- data/lib/dependency-tracker-client/models/score.rb +233 -0
- data/lib/dependency-tracker-client/models/search_result.rb +208 -0
- data/lib/dependency-tracker-client/models/tag.rb +252 -0
- data/lib/dependency-tracker-client/models/team.rb +310 -0
- data/lib/dependency-tracker-client/models/user_principal.rb +255 -0
- data/lib/dependency-tracker-client/models/vulnerability.rb +729 -0
- data/lib/dependency-tracker-client/models/vulnerability_metrics.rb +238 -0
- data/lib/dependency-tracker-client/models/vulnerable_software.rb +442 -0
- data/lib/dependency-tracker-client/version.rb +15 -0
- data/lib/dependency-tracker-client.rb +109 -0
- data/pkg/dependency-tracker-client-1.0.0.gem +0 -0
- data/spec/api/analysis_api_spec.rb +70 -0
- data/spec/api/badge_api_spec.rb +58 -0
- data/spec/api/bom_api_spec.rb +106 -0
- data/spec/api/calculator_api_spec.rb +46 -0
- data/spec/api/component_api_spec.rb +110 -0
- data/spec/api/config_property_api_spec.rb +67 -0
- data/spec/api/cwe_api_spec.rb +56 -0
- data/spec/api/default_api_spec.rb +123 -0
- data/spec/api/dependency_api_spec.rb +79 -0
- data/spec/api/finding_api_spec.rb +57 -0
- data/spec/api/ldap_api_spec.rb +79 -0
- data/spec/api/license_api_spec.rb +66 -0
- data/spec/api/metrics_api_spec.rb +233 -0
- data/spec/api/permission_api_spec.rb +94 -0
- data/spec/api/project_api_spec.rb +126 -0
- data/spec/api/project_property_api_spec.rb +82 -0
- data/spec/api/repository_api_spec.rb +100 -0
- data/spec/api/search_api_spec.rb +59 -0
- data/spec/api/team_api_spec.rb +122 -0
- data/spec/api/user_api_spec.rb +183 -0
- data/spec/api/version_api_spec.rb +46 -0
- data/spec/api/vulnerability_api_spec.rb +177 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/about_spec.rb +65 -0
- data/spec/models/analysis_comment_spec.rb +53 -0
- data/spec/models/analysis_request_spec.rb +75 -0
- data/spec/models/analysis_spec.rb +57 -0
- data/spec/models/api_key_spec.rb +41 -0
- data/spec/models/body_part_spec.rb +83 -0
- data/spec/models/bom_submit_request_spec.rb +65 -0
- data/spec/models/clone_project_request_spec.rb +47 -0
- data/spec/models/component_metrics_spec.rb +119 -0
- data/spec/models/component_spec.rb +201 -0
- data/spec/models/config_property_spec.rb +69 -0
- data/spec/models/content_disposition_spec.rb +77 -0
- data/spec/models/cwe_spec.rb +47 -0
- data/spec/models/dependency_metrics_spec.rb +125 -0
- data/spec/models/dependency_request_spec.rb +53 -0
- data/spec/models/dependency_spec.rb +71 -0
- data/spec/models/finding_spec.rb +59 -0
- data/spec/models/form_data_body_part_spec.rb +107 -0
- data/spec/models/form_data_content_disposition_spec.rb +83 -0
- data/spec/models/form_data_multi_part_spec.rb +95 -0
- data/spec/models/framework_spec.rb +59 -0
- data/spec/models/identifiable_object_spec.rb +41 -0
- data/spec/models/ldap_user_spec.rb +65 -0
- data/spec/models/license_spec.rb +101 -0
- data/spec/models/managed_user_spec.rb +101 -0
- data/spec/models/mapped_ldap_group_request_spec.rb +47 -0
- data/spec/models/mapped_ldap_group_spec.rb +47 -0
- data/spec/models/media_type_spec.rb +65 -0
- data/spec/models/multi_part_spec.rb +89 -0
- data/spec/models/notification_publisher_spec.rb +77 -0
- data/spec/models/notification_rule_spec.rb +107 -0
- data/spec/models/package_url_spec.rb +77 -0
- data/spec/models/parameterized_header_spec.rb +47 -0
- data/spec/models/permission_spec.rb +47 -0
- data/spec/models/portfolio_metrics_spec.rb +149 -0
- data/spec/models/project_metrics_spec.rb +131 -0
- data/spec/models/project_property_spec.rb +75 -0
- data/spec/models/project_spec.rb +119 -0
- data/spec/models/repository_meta_component_spec.rb +75 -0
- data/spec/models/repository_spec.rb +81 -0
- data/spec/models/score_spec.rb +59 -0
- data/spec/models/search_result_spec.rb +41 -0
- data/spec/models/tag_spec.rb +47 -0
- data/spec/models/team_spec.rb +77 -0
- data/spec/models/user_principal_spec.rb +71 -0
- data/spec/models/vulnerability_metrics_spec.rb +59 -0
- data/spec/models/vulnerability_spec.rb +201 -0
- data/spec/models/vulnerable_software_spec.rb +197 -0
- data/spec/spec_helper.rb +111 -0
- data/tmp/tmp.rb +11 -0
- metadata +402 -0
@@ -0,0 +1,183 @@
|
|
1
|
+
=begin
|
2
|
+
#Dependency-Track API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 3.8.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for DependencyTacker::UserApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'UserApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = DependencyTacker::UserApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of UserApi' do
|
30
|
+
it 'should create an instance of UserApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(DependencyTacker::UserApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for add_team_to_user
|
36
|
+
# Adds the username to the specified team.
|
37
|
+
# @param username A valid username
|
38
|
+
# @param body The UUID of the team to associate username with
|
39
|
+
# @param [Hash] opts the optional parameters
|
40
|
+
# @return [UserPrincipal]
|
41
|
+
describe 'add_team_to_user test' do
|
42
|
+
it 'should work' do
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# unit tests for create_ldap_user
|
48
|
+
# Creates a new user that references an existing LDAP object.
|
49
|
+
# @param [Hash] opts the optional parameters
|
50
|
+
# @option opts [LdapUser] :body
|
51
|
+
# @return [LdapUser]
|
52
|
+
describe 'create_ldap_user test' do
|
53
|
+
it 'should work' do
|
54
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# unit tests for create_managed_user
|
59
|
+
# Creates a new user.
|
60
|
+
# @param [Hash] opts the optional parameters
|
61
|
+
# @option opts [ManagedUser] :body
|
62
|
+
# @return [ManagedUser]
|
63
|
+
describe 'create_managed_user test' do
|
64
|
+
it 'should work' do
|
65
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# unit tests for delete_ldap_user
|
70
|
+
# Deletes a user.
|
71
|
+
# @param [Hash] opts the optional parameters
|
72
|
+
# @option opts [LdapUser] :body
|
73
|
+
# @return [nil]
|
74
|
+
describe 'delete_ldap_user test' do
|
75
|
+
it 'should work' do
|
76
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# unit tests for delete_managed_user
|
81
|
+
# Deletes a user.
|
82
|
+
# @param [Hash] opts the optional parameters
|
83
|
+
# @option opts [ManagedUser] :body
|
84
|
+
# @return [nil]
|
85
|
+
describe 'delete_managed_user test' do
|
86
|
+
it 'should work' do
|
87
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# unit tests for force_change_password
|
92
|
+
# Asserts login credentials and upon successful authentication, verifies passwords match and changes users password
|
93
|
+
# Upon a successful login, a JSON Web Token will be returned in the response body. This functionality requires authentication to be enabled.
|
94
|
+
# @param [Hash] opts the optional parameters
|
95
|
+
# @option opts [String] :username
|
96
|
+
# @option opts [String] :password
|
97
|
+
# @option opts [String] :new_password
|
98
|
+
# @option opts [String] :confirm_password
|
99
|
+
# @return [String]
|
100
|
+
describe 'force_change_password test' do
|
101
|
+
it 'should work' do
|
102
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
# unit tests for get_ldap_users
|
107
|
+
# Returns a list of all LDAP users
|
108
|
+
# @param [Hash] opts the optional parameters
|
109
|
+
# @return [Array<LdapUser>]
|
110
|
+
describe 'get_ldap_users test' do
|
111
|
+
it 'should work' do
|
112
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
# unit tests for get_managed_users
|
117
|
+
# Returns a list of all managed users
|
118
|
+
# @param [Hash] opts the optional parameters
|
119
|
+
# @return [Array<ManagedUser>]
|
120
|
+
describe 'get_managed_users test' do
|
121
|
+
it 'should work' do
|
122
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
# unit tests for get_self
|
127
|
+
# Returns information about the current logged in user.
|
128
|
+
# @param [Hash] opts the optional parameters
|
129
|
+
# @return [UserPrincipal]
|
130
|
+
describe 'get_self test' do
|
131
|
+
it 'should work' do
|
132
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
# unit tests for remove_team_from_user
|
137
|
+
# Removes the username from the specified team.
|
138
|
+
# @param username A valid username
|
139
|
+
# @param body The UUID of the team to un-associate username from
|
140
|
+
# @param [Hash] opts the optional parameters
|
141
|
+
# @return [UserPrincipal]
|
142
|
+
describe 'remove_team_from_user test' do
|
143
|
+
it 'should work' do
|
144
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
# unit tests for update_managed_user
|
149
|
+
# Updates a managed user.
|
150
|
+
# @param [Hash] opts the optional parameters
|
151
|
+
# @option opts [ManagedUser] :body
|
152
|
+
# @return [ManagedUser]
|
153
|
+
describe 'update_managed_user test' do
|
154
|
+
it 'should work' do
|
155
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
# unit tests for update_self
|
160
|
+
# Updates information about the current logged in user.
|
161
|
+
# @param [Hash] opts the optional parameters
|
162
|
+
# @option opts [ManagedUser] :body
|
163
|
+
# @return [UserPrincipal]
|
164
|
+
describe 'update_self test' do
|
165
|
+
it 'should work' do
|
166
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
# unit tests for validate_credentials
|
171
|
+
# Assert login credentials
|
172
|
+
# Upon a successful login, a JSON Web Token will be returned in the response body. This functionality requires authentication to be enabled.
|
173
|
+
# @param [Hash] opts the optional parameters
|
174
|
+
# @option opts [String] :username
|
175
|
+
# @option opts [String] :password
|
176
|
+
# @return [String]
|
177
|
+
describe 'validate_credentials test' do
|
178
|
+
it 'should work' do
|
179
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
=begin
|
2
|
+
#Dependency-Track API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 3.8.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for DependencyTacker::VersionApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'VersionApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = DependencyTacker::VersionApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of VersionApi' do
|
30
|
+
it 'should create an instance of VersionApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(DependencyTacker::VersionApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for get_version
|
36
|
+
# Returns application version information
|
37
|
+
# Returns a simple json object containing the name of the application and the version
|
38
|
+
# @param [Hash] opts the optional parameters
|
39
|
+
# @return [About]
|
40
|
+
describe 'get_version test' do
|
41
|
+
it 'should work' do
|
42
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,177 @@
|
|
1
|
+
=begin
|
2
|
+
#Dependency-Track API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 3.8.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for DependencyTacker::VulnerabilityApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'VulnerabilityApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = DependencyTacker::VulnerabilityApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of VulnerabilityApi' do
|
30
|
+
it 'should create an instance of VulnerabilityApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(DependencyTacker::VulnerabilityApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for assign_vulnerability
|
36
|
+
# Assigns a vulnerability to a component
|
37
|
+
# @param source The vulnerability source
|
38
|
+
# @param vuln_id The vulnId
|
39
|
+
# @param component The UUID of the component
|
40
|
+
# @param [Hash] opts the optional parameters
|
41
|
+
# @return [nil]
|
42
|
+
describe 'assign_vulnerability test' do
|
43
|
+
it 'should work' do
|
44
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# unit tests for assign_vulnerability1
|
49
|
+
# Assigns a vulnerability to a component
|
50
|
+
# @param uuid The UUID of the vulnerability
|
51
|
+
# @param component The UUID of the component
|
52
|
+
# @param [Hash] opts the optional parameters
|
53
|
+
# @return [nil]
|
54
|
+
describe 'assign_vulnerability1 test' do
|
55
|
+
it 'should work' do
|
56
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# unit tests for create_vulnerability
|
61
|
+
# Creates a new vulnerability
|
62
|
+
# @param [Hash] opts the optional parameters
|
63
|
+
# @option opts [Vulnerability] :body
|
64
|
+
# @return [Vulnerability]
|
65
|
+
describe 'create_vulnerability test' do
|
66
|
+
it 'should work' do
|
67
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# unit tests for get_affected_project
|
72
|
+
# Returns a list of all projects affected by a specific vulnerability
|
73
|
+
# @param source
|
74
|
+
# @param vuln
|
75
|
+
# @param [Hash] opts the optional parameters
|
76
|
+
# @return [Array<Project>]
|
77
|
+
describe 'get_affected_project test' do
|
78
|
+
it 'should work' do
|
79
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# unit tests for get_all_vulnerabilities
|
84
|
+
# Returns a list of all vulnerabilities
|
85
|
+
# @param [Hash] opts the optional parameters
|
86
|
+
# @return [Array<Vulnerability>]
|
87
|
+
describe 'get_all_vulnerabilities test' do
|
88
|
+
it 'should work' do
|
89
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
# unit tests for get_vulnerabilities_by_component
|
94
|
+
# Returns a list of all vulnerabilities for a specific component
|
95
|
+
# A valid UUID of the component may be specified, or the MD5 or SHA1 hash of the component
|
96
|
+
# @param ident
|
97
|
+
# @param [Hash] opts the optional parameters
|
98
|
+
# @option opts [Boolean] :suppressed Optionally includes suppressed vulnerabilities
|
99
|
+
# @return [Array<Vulnerability>]
|
100
|
+
describe 'get_vulnerabilities_by_component test' do
|
101
|
+
it 'should work' do
|
102
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
# unit tests for get_vulnerabilities_by_project
|
107
|
+
# Returns a list of all vulnerabilities for a specific project
|
108
|
+
# @param uuid
|
109
|
+
# @param [Hash] opts the optional parameters
|
110
|
+
# @option opts [Boolean] :suppressed Optionally includes suppressed vulnerabilities
|
111
|
+
# @return [Array<Vulnerability>]
|
112
|
+
describe 'get_vulnerabilities_by_project test' do
|
113
|
+
it 'should work' do
|
114
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
# unit tests for get_vulnerability_by_uuid
|
119
|
+
# Returns a specific vulnerability
|
120
|
+
# @param uuid The UUID of the vulnerability
|
121
|
+
# @param [Hash] opts the optional parameters
|
122
|
+
# @return [Vulnerability]
|
123
|
+
describe 'get_vulnerability_by_uuid test' do
|
124
|
+
it 'should work' do
|
125
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
# unit tests for get_vulnerability_by_vuln_id
|
130
|
+
# Returns a specific vulnerability
|
131
|
+
# @param source
|
132
|
+
# @param vuln
|
133
|
+
# @param [Hash] opts the optional parameters
|
134
|
+
# @return [Vulnerability]
|
135
|
+
describe 'get_vulnerability_by_vuln_id test' do
|
136
|
+
it 'should work' do
|
137
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
# unit tests for unassign_vulnerability
|
142
|
+
# Removes assignment of a vulnerability from a component
|
143
|
+
# @param source The vulnerability source
|
144
|
+
# @param vuln_id The vulnId
|
145
|
+
# @param component The UUID of the component
|
146
|
+
# @param [Hash] opts the optional parameters
|
147
|
+
# @return [nil]
|
148
|
+
describe 'unassign_vulnerability test' do
|
149
|
+
it 'should work' do
|
150
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
# unit tests for unassign_vulnerability1
|
155
|
+
# Removes assignment of a vulnerability from a component
|
156
|
+
# @param uuid The UUID of the vulnerability
|
157
|
+
# @param component The UUID of the component
|
158
|
+
# @param [Hash] opts the optional parameters
|
159
|
+
# @return [nil]
|
160
|
+
describe 'unassign_vulnerability1 test' do
|
161
|
+
it 'should work' do
|
162
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
# unit tests for update_vulnerability
|
167
|
+
# Updates an internal vulnerability
|
168
|
+
# @param [Hash] opts the optional parameters
|
169
|
+
# @option opts [Vulnerability] :body
|
170
|
+
# @return [Project]
|
171
|
+
describe 'update_vulnerability test' do
|
172
|
+
it 'should work' do
|
173
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
end
|
@@ -0,0 +1,226 @@
|
|
1
|
+
=begin
|
2
|
+
#Dependency-Track API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 3.8.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
|
15
|
+
describe DependencyTacker::ApiClient do
|
16
|
+
context 'initialization' do
|
17
|
+
context 'URL stuff' do
|
18
|
+
context 'host' do
|
19
|
+
it 'removes http from host' do
|
20
|
+
DependencyTacker.configure { |c| c.host = 'http://example.com' }
|
21
|
+
expect(DependencyTacker::Configuration.default.host).to eq('example.com')
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'removes https from host' do
|
25
|
+
DependencyTacker.configure { |c| c.host = 'https://wookiee.com' }
|
26
|
+
expect(DependencyTacker::ApiClient.default.config.host).to eq('wookiee.com')
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'removes trailing path from host' do
|
30
|
+
DependencyTacker.configure { |c| c.host = 'hobo.com/v4' }
|
31
|
+
expect(DependencyTacker::Configuration.default.host).to eq('hobo.com')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'base_path' do
|
36
|
+
it "prepends a slash to base_path" do
|
37
|
+
DependencyTacker.configure { |c| c.base_path = 'v4/dog' }
|
38
|
+
expect(DependencyTacker::Configuration.default.base_path).to eq('/v4/dog')
|
39
|
+
end
|
40
|
+
|
41
|
+
it "doesn't prepend a slash if one is already there" do
|
42
|
+
DependencyTacker.configure { |c| c.base_path = '/v4/dog' }
|
43
|
+
expect(DependencyTacker::Configuration.default.base_path).to eq('/v4/dog')
|
44
|
+
end
|
45
|
+
|
46
|
+
it "ends up as a blank string if nil" do
|
47
|
+
DependencyTacker.configure { |c| c.base_path = nil }
|
48
|
+
expect(DependencyTacker::Configuration.default.base_path).to eq('')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe 'params_encoding in #build_request' do
|
55
|
+
let(:config) { DependencyTacker::Configuration.new }
|
56
|
+
let(:api_client) { DependencyTacker::ApiClient.new(config) }
|
57
|
+
|
58
|
+
it 'defaults to nil' do
|
59
|
+
expect(DependencyTacker::Configuration.default.params_encoding).to eq(nil)
|
60
|
+
expect(config.params_encoding).to eq(nil)
|
61
|
+
|
62
|
+
request = api_client.build_request(:get, '/test')
|
63
|
+
expect(request.options[:params_encoding]).to eq(nil)
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'can be customized' do
|
67
|
+
config.params_encoding = :multi
|
68
|
+
request = api_client.build_request(:get, '/test')
|
69
|
+
expect(request.options[:params_encoding]).to eq(:multi)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe 'timeout in #build_request' do
|
74
|
+
let(:config) { DependencyTacker::Configuration.new }
|
75
|
+
let(:api_client) { DependencyTacker::ApiClient.new(config) }
|
76
|
+
|
77
|
+
it 'defaults to 0' do
|
78
|
+
expect(DependencyTacker::Configuration.default.timeout).to eq(0)
|
79
|
+
expect(config.timeout).to eq(0)
|
80
|
+
|
81
|
+
request = api_client.build_request(:get, '/test')
|
82
|
+
expect(request.options[:timeout]).to eq(0)
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'can be customized' do
|
86
|
+
config.timeout = 100
|
87
|
+
request = api_client.build_request(:get, '/test')
|
88
|
+
expect(request.options[:timeout]).to eq(100)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe '#deserialize' do
|
93
|
+
it "handles Array<Integer>" do
|
94
|
+
api_client = DependencyTacker::ApiClient.new
|
95
|
+
headers = { 'Content-Type' => 'application/json' }
|
96
|
+
response = double('response', headers: headers, body: '[12, 34]')
|
97
|
+
data = api_client.deserialize(response, 'Array<Integer>')
|
98
|
+
expect(data).to be_instance_of(Array)
|
99
|
+
expect(data).to eq([12, 34])
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'handles Array<Array<Integer>>' do
|
103
|
+
api_client = DependencyTacker::ApiClient.new
|
104
|
+
headers = { 'Content-Type' => 'application/json' }
|
105
|
+
response = double('response', headers: headers, body: '[[12, 34], [56]]')
|
106
|
+
data = api_client.deserialize(response, 'Array<Array<Integer>>')
|
107
|
+
expect(data).to be_instance_of(Array)
|
108
|
+
expect(data).to eq([[12, 34], [56]])
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'handles Hash<String, String>' do
|
112
|
+
api_client = DependencyTacker::ApiClient.new
|
113
|
+
headers = { 'Content-Type' => 'application/json' }
|
114
|
+
response = double('response', headers: headers, body: '{"message": "Hello"}')
|
115
|
+
data = api_client.deserialize(response, 'Hash<String, String>')
|
116
|
+
expect(data).to be_instance_of(Hash)
|
117
|
+
expect(data).to eq(:message => 'Hello')
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
describe "#object_to_hash" do
|
122
|
+
it 'ignores nils and includes empty arrays' do
|
123
|
+
# uncomment below to test object_to_hash for model
|
124
|
+
# api_client = DependencyTacker::ApiClient.new
|
125
|
+
# _model = DependencyTacker::ModelName.new
|
126
|
+
# update the model attribute below
|
127
|
+
# _model.id = 1
|
128
|
+
# update the expected value (hash) below
|
129
|
+
# expected = {id: 1, name: '', tags: []}
|
130
|
+
# expect(api_client.object_to_hash(_model)).to eq(expected)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
describe '#build_collection_param' do
|
135
|
+
let(:param) { ['aa', 'bb', 'cc'] }
|
136
|
+
let(:api_client) { DependencyTacker::ApiClient.new }
|
137
|
+
|
138
|
+
it 'works for csv' do
|
139
|
+
expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
|
140
|
+
end
|
141
|
+
|
142
|
+
it 'works for ssv' do
|
143
|
+
expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
|
144
|
+
end
|
145
|
+
|
146
|
+
it 'works for tsv' do
|
147
|
+
expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
|
148
|
+
end
|
149
|
+
|
150
|
+
it 'works for pipes' do
|
151
|
+
expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
|
152
|
+
end
|
153
|
+
|
154
|
+
it 'works for multi' do
|
155
|
+
expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
|
156
|
+
end
|
157
|
+
|
158
|
+
it 'fails for invalid collection format' do
|
159
|
+
expect { api_client.build_collection_param(param, :INVALID) }.to raise_error(RuntimeError, 'unknown collection format: :INVALID')
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
describe '#json_mime?' do
|
164
|
+
let(:api_client) { DependencyTacker::ApiClient.new }
|
165
|
+
|
166
|
+
it 'works' do
|
167
|
+
expect(api_client.json_mime?(nil)).to eq false
|
168
|
+
expect(api_client.json_mime?('')).to eq false
|
169
|
+
|
170
|
+
expect(api_client.json_mime?('application/json')).to eq true
|
171
|
+
expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
|
172
|
+
expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
|
173
|
+
|
174
|
+
expect(api_client.json_mime?('application/xml')).to eq false
|
175
|
+
expect(api_client.json_mime?('text/plain')).to eq false
|
176
|
+
expect(api_client.json_mime?('application/jsonp')).to eq false
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
describe '#select_header_accept' do
|
181
|
+
let(:api_client) { DependencyTacker::ApiClient.new }
|
182
|
+
|
183
|
+
it 'works' do
|
184
|
+
expect(api_client.select_header_accept(nil)).to be_nil
|
185
|
+
expect(api_client.select_header_accept([])).to be_nil
|
186
|
+
|
187
|
+
expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
|
188
|
+
expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
189
|
+
expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
190
|
+
|
191
|
+
expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
|
192
|
+
expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
describe '#select_header_content_type' do
|
197
|
+
let(:api_client) { DependencyTacker::ApiClient.new }
|
198
|
+
|
199
|
+
it 'works' do
|
200
|
+
expect(api_client.select_header_content_type(nil)).to eq('application/json')
|
201
|
+
expect(api_client.select_header_content_type([])).to eq('application/json')
|
202
|
+
|
203
|
+
expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
|
204
|
+
expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
205
|
+
expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
206
|
+
expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
|
207
|
+
expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
describe '#sanitize_filename' do
|
212
|
+
let(:api_client) { DependencyTacker::ApiClient.new }
|
213
|
+
|
214
|
+
it 'works' do
|
215
|
+
expect(api_client.sanitize_filename('sun')).to eq('sun')
|
216
|
+
expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
|
217
|
+
expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
|
218
|
+
expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
|
219
|
+
expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
|
220
|
+
expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
|
221
|
+
expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
|
222
|
+
expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
|
223
|
+
expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
=begin
|
2
|
+
#Dependency-Track API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 3.8.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
|
15
|
+
describe DependencyTacker::Configuration do
|
16
|
+
let(:config) { DependencyTacker::Configuration.default }
|
17
|
+
|
18
|
+
before(:each) do
|
19
|
+
# uncomment below to setup host and base_path
|
20
|
+
# require 'URI'
|
21
|
+
# uri = URI.parse("http://localhost/api")
|
22
|
+
# DependencyTacker.configure do |c|
|
23
|
+
# c.host = uri.host
|
24
|
+
# c.base_path = uri.path
|
25
|
+
# end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '#base_url' do
|
29
|
+
it 'should have the default value' do
|
30
|
+
# uncomment below to test default value of the base path
|
31
|
+
# expect(config.base_url).to eq("http://localhost/api")
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should remove trailing slashes' do
|
35
|
+
[nil, '', '/', '//'].each do |base_path|
|
36
|
+
config.base_path = base_path
|
37
|
+
# uncomment below to test trailing slashes
|
38
|
+
# expect(config.base_url).to eq("http://localhost/api")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|