foreman_scc_manager 3.1.1 → 4.0.1

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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -8
  3. data/app/assets/javascripts/foreman_scc_manager/locale/de/foreman_scc_manager.js +341 -341
  4. data/app/assets/javascripts/foreman_scc_manager/locale/el/foreman_scc_manager.js +288 -288
  5. data/app/assets/javascripts/foreman_scc_manager/locale/en/foreman_scc_manager.js +2 -582
  6. data/app/assets/javascripts/foreman_scc_manager/locale/fr/foreman_scc_manager.js +1 -1
  7. data/app/assets/javascripts/foreman_scc_manager/locale/ja/foreman_scc_manager.js +348 -348
  8. data/app/assets/javascripts/foreman_scc_manager/locale/ka/foreman_scc_manager.js +381 -381
  9. data/app/assets/javascripts/foreman_scc_manager/locale/ko/foreman_scc_manager.js +592 -0
  10. data/app/assets/javascripts/foreman_scc_manager/locale/zh_CN/foreman_scc_manager.js +346 -346
  11. data/app/models/concerns/recurring_logic_extensions.rb +4 -6
  12. data/lib/foreman_scc_manager/engine.rb +80 -83
  13. data/lib/foreman_scc_manager/version.rb +1 -1
  14. data/locale/Makefile +12 -2
  15. data/locale/de/LC_MESSAGES/foreman_scc_manager.mo +0 -0
  16. data/locale/de/foreman_scc_manager.po +101 -98
  17. data/locale/el/LC_MESSAGES/foreman_scc_manager.mo +0 -0
  18. data/locale/el/foreman_scc_manager.po +25 -24
  19. data/locale/en/foreman_scc_manager.po +0 -593
  20. data/locale/fr/LC_MESSAGES/foreman_scc_manager.mo +0 -0
  21. data/locale/fr/foreman_scc_manager.po +1 -1
  22. data/locale/ja/LC_MESSAGES/foreman_scc_manager.mo +0 -0
  23. data/locale/ja/foreman_scc_manager.po +94 -92
  24. data/locale/ka/LC_MESSAGES/foreman_scc_manager.mo +0 -0
  25. data/locale/ka/foreman_scc_manager.po +139 -133
  26. data/locale/ko/LC_MESSAGES/foreman_scc_manager.mo +0 -0
  27. data/locale/ko/foreman_scc_manager.po +600 -0
  28. data/locale/zh_CN/LC_MESSAGES/foreman_scc_manager.mo +0 -0
  29. data/locale/zh_CN/foreman_scc_manager.po +92 -91
  30. data/test/controllers/api/v2/scc_accounts_test.rb +5 -5
  31. data/test/features/sync_test.rb +3 -3
  32. data/test/lib/scc_manager_test.rb +64 -0
  33. data/test/test_plugin_helper.rb +4 -1
  34. metadata +23 -7
@@ -4,17 +4,18 @@
4
4
  # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
5
  #
6
6
  # Translators:
7
- # Bryan Kearney <bryan.kearney@gmail.com>, 2019
8
7
  # tim123, 2019
8
+ # Bryan Kearney <bryan.kearney@gmail.com>, 2022
9
9
  # Amit Upadhye <aupadhye@redhat.com>, 2022
10
10
  #
11
+ #, fuzzy
11
12
  msgid ""
12
13
  msgstr ""
13
- "Project-Id-Version: foreman_scc_manager 1.0.0\n"
14
+ "Project-Id-Version: foreman_scc_manager 4.0.0\n"
14
15
  "Report-Msgid-Bugs-To: \n"
15
16
  "PO-Revision-Date: 2019-10-17 13:28+0000\n"
16
17
  "Last-Translator: Amit Upadhye <aupadhye@redhat.com>, 2022\n"
17
- "Language-Team: Chinese (China) (https://www.transifex.com/foreman/teams/114/zh"
18
+ "Language-Team: Chinese (China) (https://app.transifex.com/foreman/teams/114/zh"
18
19
  "_CN/)\n"
19
20
  "MIME-Version: 1.0\n"
20
21
  "Content-Type: text/plain; charset=UTF-8\n"
@@ -38,13 +39,13 @@ msgid "%s/%s"
38
39
  msgstr ""
39
40
 
40
41
  msgid "Abstract"
41
- msgstr ""
42
+ msgstr "摘要"
42
43
 
43
44
  msgid "Abstract async task"
44
- msgstr ""
45
+ msgstr "抽象 async 任务"
45
46
 
46
47
  msgid "Action with sub plans"
47
- msgstr ""
48
+ msgstr "有子计划的操作"
48
49
 
49
50
  msgid "Actions"
50
51
  msgstr "操作"
@@ -62,25 +63,25 @@ msgid "Add product(s)"
62
63
  msgstr ""
63
64
 
64
65
  msgid "Additive"
65
- msgstr ""
66
+ msgstr "Additive"
66
67
 
67
68
  msgid "Agent action"
68
- msgstr ""
69
+ msgstr "代理操作"
69
70
 
70
71
  msgid "Associated GPG key of scc_account"
71
72
  msgstr "scc_account 的关联 GPG 密钥"
72
73
 
73
74
  msgid "Attach subscriptions"
74
- msgstr ""
75
+ msgstr "附加订阅"
75
76
 
76
77
  msgid "Auto attach subscriptions"
77
- msgstr ""
78
+ msgstr "自动附加订阅"
78
79
 
79
80
  msgid "Base URL"
80
81
  msgstr "基本 URL"
81
82
 
82
83
  msgid "Bulk generate applicability for hosts"
83
- msgstr ""
84
+ msgstr "批量生成主机的适用性"
84
85
 
85
86
  msgid "Bulk subscription of scc_products for scc_account"
86
87
  msgstr "scc_account 的批量 scc_products 订阅"
@@ -95,31 +96,31 @@ msgid "Collapse/Expand"
95
96
  msgstr ""
96
97
 
97
98
  msgid "Combined Profile Update"
98
- msgstr ""
99
+ msgstr "组合的配置集更新"
99
100
 
100
101
  msgid "Content Only"
101
- msgstr ""
102
+ msgstr "只包括内容"
102
103
 
103
104
  msgid "Copy version units to library"
104
- msgstr ""
105
+ msgstr "将版本单位复制到库"
105
106
 
106
107
  msgid "Create"
107
- msgstr ""
108
+ msgstr "创建"
108
109
 
109
110
  msgid "Create Alternate Content Source"
110
- msgstr ""
111
+ msgstr "创建备用内容源"
111
112
 
112
113
  msgid "Create Export History"
113
- msgstr ""
114
+ msgstr "创建导出历史记录"
114
115
 
115
116
  msgid "Create Import History"
116
- msgstr ""
117
+ msgstr "创建导入历史记录"
117
118
 
118
119
  msgid "Create Package Group"
119
- msgstr ""
120
+ msgstr "创建软件包组"
120
121
 
121
122
  msgid "Create Syncable Export History"
122
- msgstr ""
123
+ msgstr "创建可同步的导出历史记录"
123
124
 
124
125
  msgid "Create an scc_account"
125
126
  msgstr "创建 scc_account"
@@ -131,61 +132,61 @@ msgid "Date and time relative to which the sync interval is run"
131
132
  msgstr "运行同步间隔的日期和时间"
132
133
 
133
134
  msgid "Delete"
134
- msgstr ""
135
+ msgstr "刪除"
135
136
 
136
137
  msgid "Delete Activation Key"
137
- msgstr ""
138
+ msgstr "删除激活码"
138
139
 
139
140
  msgid "Delete Lifecycle Environment"
140
- msgstr ""
141
+ msgstr "删除生命周期环境"
141
142
 
142
143
  msgid "Delete Package Group"
143
- msgstr ""
144
+ msgstr "删除软件包组"
144
145
 
145
146
  msgid "Delete Product"
146
- msgstr ""
147
+ msgstr "删除产品"
147
148
 
148
149
  msgid "Delete scc_account"
149
150
  msgstr "删除 scc_account"
150
151
 
151
152
  msgid "Destroy"
152
- msgstr ""
153
+ msgstr "销毁"
153
154
 
154
155
  msgid "Destroy Alternate Content Source"
155
- msgstr ""
156
+ msgstr "销毁备用内容源"
156
157
 
157
158
  msgid "Destroy Content Host"
158
- msgstr ""
159
+ msgstr "销毁内容主机"
159
160
 
160
161
  msgid "Disable"
161
- msgstr ""
162
+ msgstr "禁用"
162
163
 
163
164
  msgid "Discover"
164
- msgstr ""
165
+ msgstr "发现"
165
166
 
166
167
  msgid "Download Policy"
167
- msgstr ""
168
+ msgstr "下载政策"
168
169
 
169
170
  msgid "Edit %s"
170
171
  msgstr "编辑 %s"
171
172
 
172
173
  msgid "Enable"
173
- msgstr ""
174
+ msgstr "启用"
174
175
 
175
176
  msgid "Errata mail"
176
- msgstr ""
177
+ msgstr "勘误邮件"
177
178
 
178
179
  msgid "Expand products"
179
180
  msgstr ""
180
181
 
181
182
  msgid "Export"
182
- msgstr ""
183
+ msgstr "导出"
183
184
 
184
185
  msgid "Export Library"
185
- msgstr ""
186
+ msgstr "导出库"
186
187
 
187
188
  msgid "Export Repository"
188
- msgstr ""
189
+ msgstr "导出仓库"
189
190
 
190
191
  msgid "Failed to add task to queue."
191
192
  msgstr ""
@@ -194,22 +195,22 @@ msgid "Failed to add task to queue: %s"
194
195
  msgstr "向队列添加任务失败:%s"
195
196
 
196
197
  msgid "Fetch pxe files"
197
- msgstr ""
198
+ msgstr "获取 pxe 文件"
198
199
 
199
200
  msgid "Filter repositories"
200
201
  msgstr ""
201
202
 
202
203
  msgid "Filtered index content"
203
- msgstr ""
204
+ msgstr "已过滤的索引内容"
204
205
 
205
206
  msgid "Foreman plugin to sync SUSE Customer Center products and repositories into Katello."
206
207
  msgstr "Foreman 插件,将 SUSE 客户中心产品和存储库同步到 Katello。"
207
208
 
208
209
  msgid "Generate host applicability"
209
- msgstr ""
210
+ msgstr "产生主机适用性"
210
211
 
211
212
  msgid "Generate repository applicability"
212
- msgstr ""
213
+ msgstr "生成仓库适用性"
213
214
 
214
215
  msgid "Go to Product page"
215
216
  msgstr ""
@@ -218,61 +219,61 @@ msgid "Go to Repository page"
218
219
  msgstr ""
219
220
 
220
221
  msgid "Hypervisors"
221
- msgstr ""
222
+ msgstr "Hypervisor"
222
223
 
223
224
  msgid "Hypervisors update"
224
- msgstr ""
225
+ msgstr "Hypervisor 更新"
225
226
 
226
227
  msgid "If this option is enabled, debug and source pool repositories are automatically selected if you select a product. This option is disabled by default. It applies for unselected products, only. Already selected products are not filtered."
227
228
  msgstr ""
228
229
 
229
230
  msgid "Immediate"
230
- msgstr ""
231
+ msgstr "立即"
231
232
 
232
233
  msgid "Import"
233
- msgstr ""
234
+ msgstr "导入"
234
235
 
235
236
  msgid "Import Content View Version"
236
- msgstr ""
237
+ msgstr "导入内容视图版本"
237
238
 
238
239
  msgid "Import Default Content View"
239
- msgstr ""
240
+ msgstr "导入默认内容视图"
240
241
 
241
242
  msgid "Import Puppet classes"
242
- msgstr ""
243
+ msgstr "导入 Puppet 类"
243
244
 
244
245
  msgid "Import Repository"
245
- msgstr ""
246
+ msgstr "导入仓库"
246
247
 
247
248
  msgid "Import facts"
248
- msgstr ""
249
+ msgstr "导入事实"
249
250
 
250
251
  msgid "Include Debug and Source Pool repositories"
251
252
  msgstr ""
252
253
 
253
254
  msgid "Incremental Update"
254
- msgstr ""
255
+ msgstr "增量更新"
255
256
 
256
257
  msgid "Incremental Update of Content View Version(s) "
257
- msgstr ""
258
+ msgstr "内容视图版本的增量更新"
258
259
 
259
260
  msgid "Index content"
260
- msgstr ""
261
+ msgstr "索引內容"
261
262
 
262
263
  msgid "Index errata"
263
- msgstr ""
264
+ msgstr "索引勘误"
264
265
 
265
266
  msgid "Index module streams"
266
- msgstr ""
267
+ msgstr "索引模块流"
267
268
 
268
269
  msgid "Index package groups"
269
- msgstr ""
270
+ msgstr "索引软件包组"
270
271
 
271
272
  msgid "Install Applicable Errata"
272
- msgstr ""
273
+ msgstr "安装适用的勘误"
273
274
 
274
275
  msgid "Instance update"
275
- msgstr ""
276
+ msgstr "实例更新"
276
277
 
277
278
  msgid "Interval cannot be nil"
278
279
  msgstr "间隔不能为零"
@@ -299,7 +300,7 @@ msgid "Login id of scc_account"
299
300
  msgstr "scc_account 的登录 ID"
300
301
 
301
302
  msgid "Mirroring Policy"
302
- msgstr ""
303
+ msgstr "镜像策略"
303
304
 
304
305
  msgid "Name of the scc_account"
305
306
  msgstr "scc_account 的名称"
@@ -311,10 +312,10 @@ msgid "None"
311
312
  msgstr "没有"
312
313
 
313
314
  msgid "On Demand"
314
- msgstr ""
315
+ msgstr "按需"
315
316
 
316
317
  msgid "Package Profile Update"
317
- msgstr ""
318
+ msgstr "软件包配置集更新"
318
319
 
319
320
  msgid "Password of scc_account"
320
321
  msgstr "scc_account 的密码"
@@ -326,7 +327,7 @@ msgid "Please synchronize your SUSE account before you can subscribe to SUSE pro
326
327
  msgstr ""
327
328
 
328
329
  msgid "Product Create"
329
- msgstr ""
330
+ msgstr "产品创建"
330
331
 
331
332
  msgid "Product Selection for Account %s"
332
333
  msgstr "为帐户 %s 选择产品"
@@ -335,37 +336,37 @@ msgid "Products"
335
336
  msgstr "产品"
336
337
 
337
338
  msgid "Promote"
338
- msgstr ""
339
+ msgstr "升级"
339
340
 
340
341
  msgid "Promotion to Environment"
341
- msgstr ""
342
+ msgstr "升级到环境"
342
343
 
343
344
  msgid "Publish"
344
- msgstr ""
345
+ msgstr "发布"
345
346
 
346
347
  msgid "Publish Lifecycle Environment Repositories"
347
- msgstr ""
348
+ msgstr "发布生命周期环境仓库"
348
349
 
349
350
  msgid "Refresh Alternate Content Source"
350
- msgstr ""
351
+ msgstr "刷新备用内容源"
351
352
 
352
353
  msgid "Reindex subscriptions"
353
- msgstr ""
354
+ msgstr "重新索引订阅"
354
355
 
355
356
  msgid "Remove Content"
356
- msgstr ""
357
+ msgstr "删除内容"
357
358
 
358
359
  msgid "Remove Version"
359
- msgstr ""
360
+ msgstr "移除版本"
360
361
 
361
362
  msgid "Remove Versions and Associations"
362
- msgstr ""
363
+ msgstr "删除版本和关联"
363
364
 
364
365
  msgid "Remove from Environment"
365
- msgstr ""
366
+ msgstr "从环境中移除"
366
367
 
367
368
  msgid "Remove subscriptions"
368
- msgstr ""
369
+ msgstr "删除订阅"
369
370
 
370
371
  msgid "Repositories (%s/%s)"
371
372
  msgstr ""
@@ -374,13 +375,13 @@ msgid "Repository not imported"
374
375
  msgstr ""
375
376
 
376
377
  msgid "Republish Version Repositories"
377
- msgstr ""
378
+ msgstr "发布版本库"
378
379
 
379
380
  msgid "Reset Selection"
380
381
  msgstr ""
381
382
 
382
383
  msgid "Run Sync Plan:"
383
- msgstr ""
384
+ msgstr "运行同步计划:"
384
385
 
385
386
  msgid "SUSE Customer Center"
386
387
  msgstr "SUSE 客户中心"
@@ -467,7 +468,7 @@ msgid "Sync SUSE subscriptions (Repositories)"
467
468
  msgstr "同步 SUSE 订阅(仓库)"
468
469
 
469
470
  msgid "Sync capsule"
470
- msgstr ""
471
+ msgstr "同步 capsule"
471
472
 
472
473
  msgid "Sync interval"
473
474
  msgstr "同步间隔"
@@ -479,16 +480,16 @@ msgid "Sync task started."
479
480
  msgstr "同步任务已启动。"
480
481
 
481
482
  msgid "Syncable export"
482
- msgstr ""
483
+ msgstr "可同步导出"
483
484
 
484
485
  msgid "Synchronize"
485
- msgstr ""
486
+ msgstr "同步"
486
487
 
487
488
  msgid "Synchronize SUSE Account"
488
489
  msgstr ""
489
490
 
490
491
  msgid "Synchronize smart proxy"
491
- msgstr ""
492
+ msgstr "同步智能代理服务器"
492
493
 
493
494
  msgid "Task to subscribe products started."
494
495
  msgstr "订阅产品的任务已开始。"
@@ -527,16 +528,16 @@ msgid "Unknown"
527
528
  msgstr "未知"
528
529
 
529
530
  msgid "Update"
530
- msgstr ""
531
+ msgstr "更新"
531
532
 
532
533
  msgid "Update Alternate Content Source"
533
- msgstr ""
534
+ msgstr "更新备用内容源"
534
535
 
535
536
  msgid "Update CDN Configuration"
536
- msgstr ""
537
+ msgstr "更新 CDN 配置"
537
538
 
538
539
  msgid "Update Content Overrides"
539
- msgstr ""
540
+ msgstr "更新内容覆盖"
540
541
 
541
542
  msgid "Update SUSE repositories"
542
543
  msgstr "创建 SUSE 仓库"
@@ -545,31 +546,31 @@ msgid "Update SUSE repositories %s"
545
546
  msgstr "更新 SUSE 仓库 %s"
546
547
 
547
548
  msgid "Update content urls"
548
- msgstr ""
549
+ msgstr "更新内容 url"
549
550
 
550
551
  msgid "Update for host"
551
- msgstr ""
552
+ msgstr "对主机的更新"
552
553
 
553
554
  msgid "Update http proxy"
554
- msgstr ""
555
+ msgstr "更新 HTTP 代理"
555
556
 
556
557
  msgid "Update http proxy details"
557
- msgstr ""
558
+ msgstr "更新 http 代理详情"
558
559
 
559
560
  msgid "Update redhat repository"
560
- msgstr ""
561
+ msgstr "更新 redhat 仓库"
561
562
 
562
563
  msgid "Update release version for host"
563
- msgstr ""
564
+ msgstr "为主机更新发行版本"
564
565
 
565
566
  msgid "Update scc_account"
566
567
  msgstr "更新 scc_account"
567
568
 
568
569
  msgid "Updating System Purpose for host"
569
- msgstr ""
570
+ msgstr "主机更新系统目的"
570
571
 
571
572
  msgid "Upload into"
572
- msgstr ""
573
+ msgstr "上传到"
573
574
 
574
575
  msgid "Use GPG key for SUSE products"
575
576
  msgstr "将 GPG 密钥用于 SUSE 产品"
@@ -581,7 +582,7 @@ msgid "Use your 'Organization credentials' obtained from the SUSE Customer Cente
581
582
  msgstr "使用从 SUSE 客户中心获取的\"组织凭据\"。"
582
583
 
583
584
  msgid "Verify checksum"
584
- msgstr ""
585
+ msgstr "验证校验和"
585
586
 
586
587
  msgid ""
587
588
  "WARNING: If you want to switch SCC accounts and retain the synchronized content, DO NOT delete your old SCC account, even if it is expired. Please change the login and password of your SCC account, instead.\n"
@@ -17,7 +17,7 @@ class Api::V2::SccAccountsControllerTest < ActionController::TestCase
17
17
  }
18
18
  ).to_return(
19
19
  status: 200,
20
- body: fixture_file_upload('data_subscriptions.json').read,
20
+ body: scc_fixture_file('data_subscriptions.json'),
21
21
  headers: {
22
22
  server: 'nginx',
23
23
  date: 'Tue, 05 Mar 2019 15:07:38 GMT',
@@ -56,7 +56,7 @@ class Api::V2::SccAccountsControllerTest < ActionController::TestCase
56
56
  }
57
57
  ).to_return(
58
58
  status: 200,
59
- body: fixture_file_upload('data_repositories.json').read,
59
+ body: scc_fixture_file('data_repositories.json'),
60
60
  headers: {
61
61
  server: 'nginx',
62
62
  date: 'Mon, 07 Oct 2019 13:14:31 GMT',
@@ -95,7 +95,7 @@ class Api::V2::SccAccountsControllerTest < ActionController::TestCase
95
95
  }
96
96
  ).to_return(
97
97
  status: 200,
98
- body: fixture_file_upload('data_products_page1.json').read,
98
+ body: scc_fixture_file('data_products_page1.json'),
99
99
  headers: {
100
100
  server: 'nginx',
101
101
  date: 'Mon, 11 Mar 2019 15:37:00 GMT',
@@ -132,7 +132,7 @@ class Api::V2::SccAccountsControllerTest < ActionController::TestCase
132
132
  }
133
133
  ).to_return(
134
134
  status: 200,
135
- body: fixture_file_upload('data_products_page2.json').read,
135
+ body: scc_fixture_file('data_products_page2.json'),
136
136
  headers: {
137
137
  server: 'nginx',
138
138
  date: 'Mon, 11 Mar 2019 15:37:19 GMT',
@@ -251,7 +251,7 @@ class Api::V2::SccAccountsControllerTest < ActionController::TestCase
251
251
  put :update, params: { id: account.id, scc_account: { :base_url => '', :sync_date => Time.now, :interval => 'weekly' } }
252
252
 
253
253
  assert_response :unprocessable_entity
254
- assert_error_message "Base url can't be blank"
254
+ assert_error_message "Base URL can't be blank"
255
255
  end
256
256
 
257
257
  test 'new account SCC server connection-test' do
@@ -13,7 +13,7 @@ class SccAccountSyncTest < ActiveSupport::TestCase
13
13
  }
14
14
  ).to_return(
15
15
  status: 200,
16
- body: fixture_file_upload('data_subscriptions.json').read,
16
+ body: scc_fixture_file('data_subscriptions.json'),
17
17
  headers: {
18
18
  server: 'nginx',
19
19
  date: 'Tue, 05 Mar 2019 15:07:38 GMT',
@@ -52,7 +52,7 @@ class SccAccountSyncTest < ActiveSupport::TestCase
52
52
  }
53
53
  ).to_return(
54
54
  status: 200,
55
- body: fixture_file_upload('data_products_page1.json').read,
55
+ body: scc_fixture_file('data_products_page1.json'),
56
56
  headers: {
57
57
  server: 'nginx',
58
58
  date: 'Mon, 11 Mar 2019 15:37:00 GMT',
@@ -89,7 +89,7 @@ class SccAccountSyncTest < ActiveSupport::TestCase
89
89
  }
90
90
  ).to_return(
91
91
  status: 200,
92
- body: fixture_file_upload('data_products_page1.json').read,
92
+ body: scc_fixture_file('data_products_page1.json'),
93
93
  headers: {
94
94
  server: 'nginx',
95
95
  date: 'Mon, 11 Mar 2019 15:37:19 GMT',
@@ -0,0 +1,64 @@
1
+ require 'test_plugin_helper'
2
+
3
+ class SccManagerTest < ActiveSupport::TestCase
4
+ def setup
5
+ @dummy_base_url = 'https://scc.example.com'
6
+ @dummy_path = '/connect/organizations/subscriptions'
7
+ @dummy_login = 'oneuser'
8
+ @dummy_password = 'onepass'
9
+ @default_headers = { headers: {
10
+ Accept: 'application/vnd.scc.suse.com.v4+json',
11
+ Authorization: 'Basic b25ldXNlcjpvbmVwYXNz',
12
+ } }
13
+ end
14
+
15
+ context 'SCC get request' do
16
+ test 'validate single response' do
17
+ stub_request(:get, "#{@dummy_base_url}#{@dummy_path}")
18
+ .with(@default_headers)
19
+ .to_return(status: 200,
20
+ body: '[{ "foo": "bar" }]',
21
+ headers: {})
22
+
23
+ results = ::SccManager.get_scc_data(@dummy_base_url,
24
+ @dummy_path,
25
+ @dummy_login,
26
+ @dummy_password)
27
+ assert_equal results[0]['foo'], 'bar'
28
+ end
29
+
30
+ test 'follow multiple links' do
31
+ stub_request(:get, "#{@dummy_base_url}#{@dummy_path}")
32
+ .with(@default_headers)
33
+ .to_return(status: 200,
34
+ body: '[{ "foo": "bar" }]',
35
+ headers: { link: '<https://scc.example.com/second/addr>; rel="next"' })
36
+
37
+ stub_request(:get, "#{@dummy_base_url}/second/addr")
38
+ .with(@default_headers)
39
+ .to_return(status: 200,
40
+ body: '[{ "foo2": "bar2" }]',
41
+ headers: {})
42
+
43
+ results = ::SccManager.get_scc_data(@dummy_base_url,
44
+ @dummy_path,
45
+ @dummy_login,
46
+ @dummy_password)
47
+ assert_equal results[0]['foo'], 'bar'
48
+ assert_equal results[1]['foo2'], 'bar2'
49
+ end
50
+
51
+ test 'fail when SCC service unavailable' do
52
+ stub_request(:get, "#{@dummy_base_url}#{@dummy_path}")
53
+ .with(@default_headers)
54
+ .to_return(status: 404, body: '', headers: {})
55
+
56
+ assert_raises RuntimeError do
57
+ ::SccManager.get_scc_data(@dummy_base_url,
58
+ @dummy_path,
59
+ @dummy_login,
60
+ @dummy_password)
61
+ end
62
+ end
63
+ end
64
+ end
@@ -23,7 +23,6 @@ module FixtureTestCase
23
23
  FileUtils.rm_rf(self.fixture_path) if File.directory?(self.fixture_path)
24
24
  Dir.mkdir(self.fixture_path)
25
25
  FileUtils.cp(Dir.glob("#{ForemanSccManager::Engine.root}/test/fixtures/models/*"), self.fixture_path)
26
- FileUtils.cp(Dir.glob("#{ForemanSccManager::Engine.root}/test/fixtures/files/*"), self.fixture_path)
27
26
  FileUtils.cp(Dir.glob("#{ForemanSccManager::Engine.root}/test/fixtures/controllers/*"), self.fixture_path)
28
27
  FileUtils.cp(Dir.glob(Rails.root.join('test/fixtures/*')), self.fixture_path)
29
28
  fixtures(:all)
@@ -52,6 +51,10 @@ class ActiveSupport::TestCase
52
51
  User.current = saved_user
53
52
  organization
54
53
  end
54
+
55
+ def scc_fixture_file(filename)
56
+ File.read(File.join(ForemanSccManager::Engine.root, 'test', 'fixtures', 'files', filename))
57
+ end
55
58
  end
56
59
 
57
60
  class ActionController::TestCase