crx_packmgr_api_client 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +33 -16
  3. data/crx_packmgr_api_client-0.2.0.gem +0 -0
  4. data/crx_packmgr_api_client.gemspec +9 -4
  5. data/docs/DefaultApi.md +457 -7
  6. data/docs/{PackageFilter.md → Filter.md} +2 -2
  7. data/docs/FilterRule.md +9 -0
  8. data/docs/Group.md +11 -0
  9. data/docs/{InlineResponse200.md → GroupList.md} +2 -2
  10. data/docs/InitData.md +13 -0
  11. data/docs/InstallStatus.md +8 -0
  12. data/docs/InstallStatusStatus.md +9 -0
  13. data/docs/Package.md +1 -1
  14. data/docs/PackageList.md +1 -0
  15. data/docs/ServiceResponse.md +12 -0
  16. data/docs/ServiceResponseRequest.md +8 -0
  17. data/docs/ServiceResponseRequestParam.md +9 -0
  18. data/docs/ServiceResponseResponse.md +9 -0
  19. data/docs/UpdateStatus.md +10 -0
  20. data/git_push.sh +1 -1
  21. data/lib/crx_packmgr_api_client.rb +13 -2
  22. data/lib/crx_packmgr_api_client/api/default_api.rb +491 -8
  23. data/lib/crx_packmgr_api_client/api_client.rb +1 -1
  24. data/lib/crx_packmgr_api_client/api_error.rb +1 -1
  25. data/lib/crx_packmgr_api_client/configuration.rb +1 -1
  26. data/lib/crx_packmgr_api_client/models/{package_filter.rb → filter.rb} +3 -3
  27. data/lib/crx_packmgr_api_client/models/filter_rule.rb +241 -0
  28. data/lib/crx_packmgr_api_client/models/group.rb +226 -0
  29. data/lib/crx_packmgr_api_client/models/{inline_response_200.rb → group_list.rb} +10 -10
  30. data/lib/crx_packmgr_api_client/models/init_data.rb +246 -0
  31. data/lib/crx_packmgr_api_client/models/install_status.rb +199 -0
  32. data/lib/crx_packmgr_api_client/models/install_status_status.rb +208 -0
  33. data/lib/crx_packmgr_api_client/models/package.rb +2 -2
  34. data/lib/crx_packmgr_api_client/models/package_list.rb +14 -5
  35. data/lib/crx_packmgr_api_client/models/service_response.rb +235 -0
  36. data/lib/crx_packmgr_api_client/models/service_response_request.rb +201 -0
  37. data/lib/crx_packmgr_api_client/models/service_response_request_param.rb +208 -0
  38. data/lib/crx_packmgr_api_client/models/service_response_response.rb +208 -0
  39. data/lib/crx_packmgr_api_client/models/update_status.rb +217 -0
  40. data/lib/crx_packmgr_api_client/version.rb +2 -2
  41. data/spec/acceptance/default_api_spec.rb +150 -0
  42. data/spec/api/default_api_spec.rb +2 -14
  43. data/spec/api/download_api_spec.rb +95 -0
  44. data/spec/api/groups_api_spec.rb +193 -0
  45. data/spec/api/init_api_spec.rb +104 -0
  46. data/spec/api/installstatus_api_spec.rb +91 -0
  47. data/spec/api/list_api_spec.rb +130 -0
  48. data/spec/api/screenshot_api_spec.rb +93 -0
  49. data/spec/api/service_api_spec.rb +374 -0
  50. data/spec/api/thumbnail_api_spec.rb +93 -0
  51. data/spec/api_client_spec.rb +1 -1
  52. data/spec/configuration_spec.rb +1 -1
  53. data/spec/files/list.json +533 -0
  54. data/spec/files/service_response.txt +11 -0
  55. data/spec/files/service_response1.txt +12 -0
  56. data/spec/files/test-1.0.0.zip +0 -0
  57. data/spec/files/thumbnail.png +0 -0
  58. data/spec/models/filter_rule_spec.rb +63 -0
  59. data/spec/models/{package_filter_spec.rb → filter_spec.rb} +7 -7
  60. data/spec/models/{inline_response_200_spec.rb → group_list_spec.rb} +8 -8
  61. data/spec/models/group_spec.rb +71 -0
  62. data/spec/models/init_data_spec.rb +83 -0
  63. data/spec/models/install_status_spec.rb +53 -0
  64. data/spec/models/install_status_status_spec.rb +59 -0
  65. data/spec/models/package_list_spec.rb +1 -1
  66. data/spec/models/package_spec.rb +1 -1
  67. data/spec/models/service_response_request_param_spec.rb +59 -0
  68. data/spec/models/service_response_request_spec.rb +53 -0
  69. data/spec/models/service_response_response_spec.rb +59 -0
  70. data/spec/models/service_response_spec.rb +77 -0
  71. data/spec/models/update_status_spec.rb +65 -0
  72. data/spec/spec_helper.rb +10 -1
  73. data/spec/spec_helper_acceptance.rb +19 -0
  74. metadata +130 -17
@@ -0,0 +1,193 @@
1
+ require 'spec_helper'
2
+
3
+ # unit tests for groups
4
+ # List package groups
5
+ # Returns a list of all package groups available.
6
+ # @param [Hash] opts the optional parameters
7
+ # @option opts [String] :compress_version Compress versions; count all versions of the same packages as a single entry.
8
+ # @option opts [BOOLEAN] :include_all Return a total count of all packages. Default to false.
9
+ # @option opts [BOOLEAN] :include_root Include the root package. Defaults to false.
10
+ # @option opts [BOOLEAN] :include_my_packages Include the 'my_packages' group. Only applicable if the group has no packages. Default to false.
11
+ # @option opts [BOOLEAN] :only_top_level Only list top-level groups, ie. do not list all nested groups.
12
+ # @return [GroupList]
13
+ describe 'DefaultApi#groups' do
14
+ before do
15
+ config = CrxPackageManager::Configuration.new
16
+ @instance = CrxPackageManager::DefaultApi.new(CrxPackageManager::ApiClient.new(config))
17
+ end
18
+
19
+ let(:groups) do
20
+ data = <<-JSON
21
+ {
22
+ "groups" : [
23
+ {
24
+ "name": "Adobe",
25
+ "title": "Adobe",
26
+ "count": 0,
27
+ "deepCount": 1
28
+ },
29
+ {
30
+ "name": "Adobe/granite",
31
+ "title": "Adobe/granite",
32
+ "count": 1,
33
+ "deepCount": 1
34
+ },
35
+ {
36
+ "name": "my_packages",
37
+ "title": "my_packages",
38
+ "count": 3,
39
+ "deepCount": 3
40
+ }
41
+ ]
42
+ }
43
+ JSON
44
+ data
45
+ end
46
+
47
+ it 'should work' do
48
+ WebMock.reset!
49
+ cfg = @instance.api_client.config
50
+ get_stub = stub_request(
51
+ :get, "#{cfg.scheme}://#{cfg.host}#{cfg.base_path}/groups.jsp"
52
+ ).to_return(status: 200, body: groups, headers: { 'Content-Type' => 'application/json' })
53
+
54
+ data = @instance.groups
55
+ expect(data).to be_a(CrxPackageManager::GroupList)
56
+ expect(data.groups).not_to be_nil
57
+ expect(data.groups.length).to eq(3)
58
+ expect(data.groups[0].name).to eq('Adobe')
59
+ expect(data.groups[0].title).to eq('Adobe')
60
+ expect(data.groups[0].count).to eq(0)
61
+ expect(data.groups[0].deep_count).to eq(1)
62
+
63
+ expect(get_stub).to have_been_requested
64
+ end
65
+
66
+ it 'should support config changes' do
67
+ WebMock.reset!
68
+ @instance.api_client.config.configure do |c|
69
+ c.scheme = 'https'
70
+ c.host = 'notlocalhost'
71
+ c.base_path = '/contextroot/crx/packgr'
72
+ c.debugging = true
73
+ end
74
+ cfg = @instance.api_client.config
75
+ get_stub = stub_request(
76
+ :get, "#{cfg.scheme}://#{cfg.host}#{cfg.base_path}/groups.jsp"
77
+ ).to_return(status: 200, body: groups, headers: { 'Content-Type' => 'application/json' })
78
+
79
+ data = @instance.groups
80
+ expect(data).to be_a(CrxPackageManager::GroupList)
81
+ expect(data.groups).not_to be_nil
82
+ expect(data.groups.length).to eq(3)
83
+ expect(data.groups[0].name).to eq('Adobe')
84
+ expect(data.groups[0].title).to eq('Adobe')
85
+ expect(data.groups[0].count).to eq(0)
86
+ expect(data.groups[0].deep_count).to eq(1)
87
+
88
+ expect(get_stub).to have_been_requested
89
+ end
90
+
91
+ it 'should support failures' do
92
+ WebMock.reset!
93
+ cfg = @instance.api_client.config
94
+ get_stub = stub_request(
95
+ :get, "#{cfg.scheme}://#{cfg.host}#{cfg.base_path}/groups.jsp"
96
+ ).to_return(status: 500)
97
+
98
+ begin
99
+ @instance.groups
100
+ rescue CrxPackageManager::ApiError => e
101
+ expect(e).not_to be_nil
102
+ expect(e.code).to eq(500)
103
+ end
104
+
105
+ expect(get_stub).to have_been_requested
106
+ end
107
+
108
+ it 'should support compressVersion' do
109
+ WebMock.reset!
110
+ cfg = @instance.api_client.config
111
+ get_stub = stub_request(
112
+ :get, "#{cfg.scheme}://#{cfg.host}#{cfg.base_path}/groups.jsp"
113
+ ).with(query: { compressVersion: true }
114
+ ).to_return(status: 200, body: groups, headers: { 'Content-Type' => 'application/json' })
115
+
116
+ data = @instance.groups(compress_version: true)
117
+ expect(data).to be_a(CrxPackageManager::GroupList)
118
+ expect(data.groups).not_to be_nil
119
+ expect(get_stub).to have_been_requested
120
+ end
121
+
122
+ it 'should support includeAll' do
123
+ WebMock.reset!
124
+ cfg = @instance.api_client.config
125
+ get_stub = stub_request(
126
+ :get, "#{cfg.scheme}://#{cfg.host}#{cfg.base_path}/groups.jsp"
127
+ ).with(query: { includeAll: true }
128
+ ).to_return(status: 200, body: groups, headers: { 'Content-Type' => 'application/json' })
129
+
130
+ data = @instance.groups(include_all: true)
131
+ expect(data).to be_a(CrxPackageManager::GroupList)
132
+ expect(data.groups).not_to be_nil
133
+ expect(get_stub).to have_been_requested
134
+ end
135
+
136
+ it 'should support includeRoot' do
137
+ WebMock.reset!
138
+ cfg = @instance.api_client.config
139
+ get_stub = stub_request(
140
+ :get, "#{cfg.scheme}://#{cfg.host}#{cfg.base_path}/groups.jsp"
141
+ ).with(query: { includeRoot: true }
142
+ ).to_return(status: 200, body: groups, headers: { 'Content-Type' => 'application/json' })
143
+
144
+ data = @instance.groups(include_root: true)
145
+ expect(data).to be_a(CrxPackageManager::GroupList)
146
+ expect(data.groups).not_to be_nil
147
+ expect(get_stub).to have_been_requested
148
+ end
149
+
150
+ it 'should support includeMyPackages' do
151
+ WebMock.reset!
152
+ cfg = @instance.api_client.config
153
+ get_stub = stub_request(
154
+ :get, "#{cfg.scheme}://#{cfg.host}#{cfg.base_path}/groups.jsp"
155
+ ).with(query: { includeMyPackages: true }
156
+ ).to_return(status: 200, body: groups, headers: { 'Content-Type' => 'application/json' })
157
+
158
+ data = @instance.groups(include_my_packages: true)
159
+ expect(data).to be_a(CrxPackageManager::GroupList)
160
+ expect(data.groups).not_to be_nil
161
+ expect(get_stub).to have_been_requested
162
+ end
163
+
164
+ it 'should support onlyTopLevel' do
165
+ WebMock.reset!
166
+ cfg = @instance.api_client.config
167
+ get_stub = stub_request(
168
+ :get, "#{cfg.scheme}://#{cfg.host}#{cfg.base_path}/groups.jsp"
169
+ ).with(query: { onlyTopLevel: true }
170
+ ).to_return(status: 200, body: groups, headers: { 'Content-Type' => 'application/json' })
171
+
172
+ data = @instance.groups(only_top_level: true)
173
+ expect(data).to be_a(CrxPackageManager::GroupList)
174
+ expect(data.groups).not_to be_nil
175
+ expect(get_stub).to have_been_requested
176
+ end
177
+
178
+ it 'should ignore other params' do
179
+ WebMock.reset!
180
+ cfg = @instance.api_client.config
181
+ get_stub = stub_request(
182
+ :get, "#{cfg.scheme}://#{cfg.host}#{cfg.base_path}/groups.jsp"
183
+ ).with(query: {}
184
+ ).to_return(status: 200, body: groups, headers: { 'Content-Type' => 'application/json' })
185
+
186
+ data = @instance.groups(other_param: 'value')
187
+ expect(data).to be_a(CrxPackageManager::GroupList)
188
+ expect(data.groups).not_to be_nil
189
+ expect(get_stub).to have_been_requested
190
+ end
191
+
192
+ end
193
+
@@ -0,0 +1,104 @@
1
+ require 'spec_helper'
2
+
3
+ # unit tests for init
4
+ # Metadata
5
+ # Display metadata about this package manager.
6
+ # @param [Hash] opts the optional parameters
7
+ # @return [InitData]
8
+ describe 'DefaultApi#init' do
9
+ before do
10
+ config = CrxPackageManager::Configuration.new
11
+ @instance = CrxPackageManager::DefaultApi.new(CrxPackageManager::ApiClient.new(config))
12
+ end
13
+
14
+ let(:init_data) do
15
+ data = <<-JSON
16
+ {
17
+ "contextPath": "/crx",
18
+ "launchpadContextPath": "/",
19
+ "jcrVersion": "2.0",
20
+ "workspace": "crx.default",
21
+ "userID": "Administrator",
22
+ "workspaces": [
23
+ "crx.default"
24
+ ]
25
+ }
26
+ JSON
27
+ data
28
+ end
29
+
30
+ it 'should work' do
31
+ WebMock.reset!
32
+ cfg = @instance.api_client.config
33
+ get_stub = stub_request(
34
+ :get, "#{cfg.scheme}://#{cfg.host}#{cfg.base_path}/init.jsp"
35
+ ).to_return(status: 200, body: init_data, headers: { 'Content-Type' => 'application/json' })
36
+
37
+ data = @instance.init
38
+ expect(data).to be_a(CrxPackageManager::InitData)
39
+ expect(data.context_path).to eq('/crx')
40
+ expect(data.launchpad_context_path).to eq('/')
41
+ expect(data.jcr_version).to eq('2.0')
42
+ expect(data.workspace).to eq('crx.default')
43
+ expect(data.user_id).to eq('Administrator')
44
+ expect(data.workspaces).to eq(['crx.default'])
45
+ expect(get_stub).to have_been_requested
46
+
47
+ end
48
+
49
+ it 'should support config changes' do
50
+ WebMock.reset!
51
+ @instance.api_client.config.configure do |c|
52
+ c.scheme = 'https'
53
+ c.host = 'notlocalhost'
54
+ c.base_path = '/contextroot/crx/packgr'
55
+ c.debugging = true
56
+ end
57
+ cfg = @instance.api_client.config
58
+ get_stub = stub_request(
59
+ :get, "#{cfg.scheme}://#{cfg.host}#{cfg.base_path}/init.jsp"
60
+ ).to_return(status: 200, body: init_data, headers: { 'Content-Type' => 'application/json' })
61
+
62
+ data = @instance.init
63
+ expect(data).to be_a(CrxPackageManager::InitData)
64
+ expect(data.context_path).to eq('/crx')
65
+ expect(data.launchpad_context_path).to eq('/')
66
+ expect(data.jcr_version).to eq('2.0')
67
+ expect(data.workspace).to eq('crx.default')
68
+ expect(data.user_id).to eq('Administrator')
69
+ expect(data.workspaces).to eq(['crx.default'])
70
+ expect(get_stub).to have_been_requested
71
+
72
+ end
73
+
74
+ it 'should support failures' do
75
+ WebMock.reset!
76
+ cfg = @instance.api_client.config
77
+ get_stub = stub_request(
78
+ :get, "#{cfg.scheme}://#{cfg.host}#{cfg.base_path}/init.jsp"
79
+ ).to_return(status: 401)
80
+
81
+ begin
82
+ @instance.init
83
+ rescue CrxPackageManager::ApiError => e
84
+ expect(e).not_to be_nil
85
+ expect(e.code).to eq(401)
86
+ end
87
+
88
+ expect(get_stub).to have_been_requested
89
+ end
90
+
91
+ it 'should ignore params' do
92
+ WebMock.reset!
93
+ cfg = @instance.api_client.config
94
+ get_stub = stub_request(
95
+ :get, "#{cfg.scheme}://#{cfg.host}#{cfg.base_path}/init.jsp"
96
+ ).with(query: {}
97
+ ).to_return(status: 200, body: init_data, headers: { 'Content-Type' => 'application/json' })
98
+
99
+ data = @instance.init(other_param: 'value')
100
+ expect(data).to be_a(CrxPackageManager::InitData)
101
+ expect(get_stub).to have_been_requested
102
+ end
103
+
104
+ end
@@ -0,0 +1,91 @@
1
+ require 'spec_helper'
2
+
3
+ # unit tests for init
4
+ # Metadata
5
+ # Display metadata about this package manager.
6
+ # @param [Hash] opts the optional parameters
7
+ # @return [InitData]
8
+ describe 'DefaultApi#installstatus' do
9
+ before do
10
+ config = CrxPackageManager::Configuration.new
11
+ @instance = CrxPackageManager::DefaultApi.new(CrxPackageManager::ApiClient.new(config))
12
+ end
13
+
14
+ let(:status) do
15
+ data = <<-JSON
16
+ {
17
+ "status": {
18
+ "finished": true,
19
+ "itemCount": 0
20
+ }
21
+ }
22
+ JSON
23
+ data
24
+ end
25
+ it 'should work' do
26
+ WebMock.reset!
27
+ cfg = @instance.api_client.config
28
+ get_stub = stub_request(
29
+ :get, "#{cfg.scheme}://#{cfg.host}#{cfg.base_path}/installstatus.jsp"
30
+ ).to_return(status: 200, body: status, headers: { 'Content-Type' => 'application/json' })
31
+
32
+ data = @instance.installstatus
33
+ expect(data).to be_a(CrxPackageManager::InstallStatus)
34
+ expect(data.status.finished).to eq(true)
35
+ expect(data.status.item_count).to eq(0)
36
+ expect(get_stub).to have_been_requested
37
+
38
+ end
39
+
40
+ it 'should support config changes' do
41
+ WebMock.reset!
42
+ @instance.api_client.config.configure do |c|
43
+ c.scheme = 'https'
44
+ c.host = 'notlocalhost'
45
+ c.base_path = '/contextroot/crx/packgr'
46
+ c.debugging = true
47
+ end
48
+ cfg = @instance.api_client.config
49
+ get_stub = stub_request(
50
+ :get, "#{cfg.scheme}://#{cfg.host}#{cfg.base_path}/installstatus.jsp"
51
+ ).to_return(status: 200, body: status, headers: { 'Content-Type' => 'application/json' })
52
+
53
+ data = @instance.installstatus
54
+ expect(data).to be_a(CrxPackageManager::InstallStatus)
55
+ expect(data.status.finished).to eq(true)
56
+ expect(data.status.item_count).to eq(0)
57
+ expect(get_stub).to have_been_requested
58
+
59
+ end
60
+
61
+ it 'should support failures' do
62
+ WebMock.reset!
63
+ cfg = @instance.api_client.config
64
+ get_stub = stub_request(
65
+ :get, "#{cfg.scheme}://#{cfg.host}#{cfg.base_path}/installstatus.jsp"
66
+ ).to_return(status: 401)
67
+
68
+ begin
69
+ @instance.installstatus
70
+ rescue CrxPackageManager::ApiError => e
71
+ expect(e).not_to be_nil
72
+ expect(e.code).to eq(401)
73
+ end
74
+
75
+ expect(get_stub).to have_been_requested
76
+ end
77
+
78
+ it 'should ignore params' do
79
+ WebMock.reset!
80
+ cfg = @instance.api_client.config
81
+ get_stub = stub_request(
82
+ :get, "#{cfg.scheme}://#{cfg.host}#{cfg.base_path}/installstatus.jsp"
83
+ ).with(query: {}
84
+ ).to_return(status: 200, body: status, headers: { 'Content-Type' => 'application/json' })
85
+
86
+ data = @instance.installstatus(other_param: 'value')
87
+ expect(data).to be_a(CrxPackageManager::InstallStatus)
88
+ expect(get_stub).to have_been_requested
89
+ end
90
+
91
+ end
@@ -0,0 +1,130 @@
1
+ require 'spec_helper'
2
+
3
+ # unit tests for list
4
+ # List packages
5
+ # Returns a list of all available packages defined.
6
+ # @param [Hash] opts the optional parameters
7
+ # @option opts [String] :q Term to search within package names.
8
+ # @option opts [BOOLEAN] :include_versions Include versions of package in results.
9
+ # @option opts [String] :path The path to a specific package definition.
10
+ # @return [PackageList]
11
+ describe 'DefaultApi#list' do
12
+ before do
13
+ config = CrxPackageManager::Configuration.new
14
+ @instance = CrxPackageManager::DefaultApi.new(CrxPackageManager::ApiClient.new(config))
15
+ end
16
+
17
+ let(:packages) do
18
+ file = File.new(File.join(File.dirname(__FILE__), '..', 'files', 'list.json'))
19
+ data = file.read
20
+ data
21
+ end
22
+
23
+ it 'should work' do
24
+ WebMock.reset!
25
+ cfg = @instance.api_client.config
26
+ get_stub = stub_request(
27
+ :get, "#{cfg.scheme}://#{cfg.host}#{cfg.base_path}/list.jsp"
28
+ ).to_return(status: 200, body: packages, headers: { 'Content-Type' => 'application/json' })
29
+
30
+ data = @instance.list
31
+ expect(data).to be_a(CrxPackageManager::PackageList)
32
+ expect(data.total).to eq(4)
33
+ expect(data.results).not_to be_nil
34
+ entry = data.results[0]
35
+ expect(entry).to be_a(CrxPackageManager::Package)
36
+ expect(entry.pid).to eq('my_packages:test:1')
37
+ expect(entry.filter).to be_a(Array)
38
+ expect(entry.filter.length).to eq(2)
39
+ filter = entry.filter[0]
40
+ expect(filter).to be_a(CrxPackageManager::Filter)
41
+ expect(filter.root).to eq('/content/dam/site')
42
+ expect(filter.rules).to be_a(Array)
43
+ expect(filter.rules.length).to eq(1)
44
+ rule = filter.rules[0]
45
+ expect(rule.modifier).to eq('exclude')
46
+ expect(rule.pattern).to eq('.*/renditions/.*')
47
+ filter = entry.filter[1]
48
+ expect(filter.root).to eq('/content/site/en/errors')
49
+ expect(get_stub).to have_been_requested
50
+ end
51
+
52
+ it 'should support config changes' do
53
+ WebMock.reset!
54
+ @instance.api_client.config.configure do |c|
55
+ c.scheme = 'https'
56
+ c.host = 'notlocalhost'
57
+ c.base_path = '/contextroot/crx/packgr'
58
+ c.debugging = true
59
+ end
60
+ cfg = @instance.api_client.config
61
+ get_stub = stub_request(
62
+ :get, "#{cfg.scheme}://#{cfg.host}#{cfg.base_path}/list.jsp"
63
+ ).to_return(status: 200, body: packages, headers: { 'Content-Type' => 'application/json' })
64
+
65
+ data = @instance.list
66
+ expect(data).to be_a(CrxPackageManager::PackageList)
67
+ expect(data.total).to eq(4)
68
+ expect(get_stub).to have_been_requested
69
+
70
+ end
71
+
72
+ it 'should support failures' do
73
+ WebMock.reset!
74
+ cfg = @instance.api_client.config
75
+ get_stub = stub_request(
76
+ :get, "#{cfg.scheme}://#{cfg.host}#{cfg.base_path}/list.jsp"
77
+ ).to_return(status: 500)
78
+
79
+ begin
80
+ @instance.list
81
+ rescue CrxPackageManager::ApiError => e
82
+ expect(e).not_to be_nil
83
+ expect(e.code).to eq(500)
84
+ end
85
+
86
+ expect(get_stub).to have_been_requested
87
+ end
88
+
89
+ it 'should support query param' do
90
+ cfg = @instance.api_client.config
91
+ get_stub = stub_request(
92
+ :get, "#{cfg.scheme}://#{cfg.host}#{cfg.base_path}/list.jsp"
93
+ ).with(query: { q: 'adobe' }
94
+ ).to_return(status: 200, body: packages, headers: { 'Content-Type' => 'application/json' })
95
+
96
+ data = @instance.list(q: 'adobe')
97
+ expect(data).to be_a(CrxPackageManager::PackageList)
98
+ expect(data.total).to eq(4)
99
+ expect(get_stub).to have_been_requested
100
+
101
+ end
102
+
103
+ it 'should support includeVersions param' do
104
+ cfg = @instance.api_client.config
105
+ get_stub = stub_request(
106
+ :get, "#{cfg.scheme}://#{cfg.host}#{cfg.base_path}/list.jsp"
107
+ ).with(query: { includeVersions: false }
108
+ ).to_return(status: 200, body: packages, headers: { 'Content-Type' => 'application/json' })
109
+
110
+ data = @instance.list(include_versions: false)
111
+ expect(data).to be_a(CrxPackageManager::PackageList)
112
+ expect(data.total).to eq(4)
113
+ expect(get_stub).to have_been_requested
114
+
115
+ end
116
+
117
+ it 'should ignore other params' do
118
+ WebMock.reset!
119
+ cfg = @instance.api_client.config
120
+ get_stub = stub_request(
121
+ :get, "#{cfg.scheme}://#{cfg.host}#{cfg.base_path}/list.jsp"
122
+ ).with(query: {}
123
+ ).to_return(status: 200, body: packages, headers: { 'Content-Type' => 'application/json' })
124
+
125
+ data = @instance.list(other_param: 'value')
126
+ expect(data).to be_a(CrxPackageManager::PackageList)
127
+ expect(data.total).to eq(4)
128
+ expect(get_stub).to have_been_requested
129
+ end
130
+ end