Skip to content

Commit bce8d1d

Browse files
committed
Add test coverage for --remove-webhooks-uuids without webhooks below API 47
Locks in the intentional behavior that the API<47 guard only applies when webhooks are actually being imported, not whenever --remove-webhooks-uuids is set.
1 parent f6babb9 commit bce8d1d

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

rd-cli-tool/src/test/groovy/org/rundeck/client/tool/commands/projects/ArchivesSpec.groovy

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,55 @@ class ArchivesSpec extends Specification {
384384
useIncludeFlags << [true, false]
385385
}
386386

387+
def "regen webhook uuids without including webhooks is allowed below api 47"() {
388+
389+
def api = Mock(RundeckApi)
390+
391+
def retrofit = new Retrofit.Builder()
392+
.addConverterFactory(JacksonConverterFactory.create())
393+
.baseUrl('http://example.com/fake/').build()
394+
def out = Mock(CommandOutput)
395+
def client = new Client(api, retrofit, null, null, 46, true, null)
396+
397+
def rdapp = Mock(RdApp) {
398+
getClient() >> client
399+
getAppConfig() >> Mock(RdClientConfig)
400+
}
401+
def rdTool = new RdToolImpl(rdapp)
402+
403+
def sut = new Archives()
404+
sut.rdOutput = out
405+
sut.rdTool = rdTool
406+
def opts = new Archives.ArchiveImportOpts()
407+
opts.components = ['test-comp'].toSet()
408+
opts.componentOptions = ['test-comp.key': 'value']
409+
opts.file = tempFile
410+
opts.project = 'Aproj'
411+
opts.whkRegenUuid = true
412+
413+
when:
414+
def result = sut.importArchive(opts)
415+
416+
then:
417+
1 * api.importProjectArchive(
418+
'Aproj',
419+
_,
420+
_,
421+
_,
422+
_,
423+
_,
424+
false,
425+
_,
426+
true,
427+
_,
428+
_,
429+
_,
430+
_
431+
) >> Calls.response(new ProjectImportStatus(successful: true))
432+
0 * api._(*_)
433+
result == 0
434+
}
435+
387436
def "import include via direct flags"() {
388437

389438
def api = Mock(RundeckApi)

0 commit comments

Comments
 (0)