|
| 1 | +/* |
| 2 | + * Copyright (c) 2025 shift7 GmbH. All rights reserved. |
| 3 | + */ |
| 4 | + |
| 5 | +package cloud.katta.cli.commands.setup; |
| 6 | + |
| 7 | +import org.junit.jupiter.api.Test; |
| 8 | +import org.mockito.Mockito; |
| 9 | + |
| 10 | +import java.util.UUID; |
| 11 | + |
| 12 | +import cloud.katta.client.ApiException; |
| 13 | +import cloud.katta.client.api.StorageProfileResourceApi; |
| 14 | +import cloud.katta.client.model.Protocol; |
| 15 | +import cloud.katta.client.model.S3STORAGECLASSES; |
| 16 | +import cloud.katta.client.model.StorageProfileS3Dto; |
| 17 | + |
| 18 | +import static org.mockito.ArgumentMatchers.any; |
| 19 | +import static org.mockito.Mockito.times; |
| 20 | + |
| 21 | +class StorageProfileAwsStaticSetupTest { |
| 22 | + @Test |
| 23 | + public void testCall() throws ApiException { |
| 24 | + final StorageProfileResourceApi api = Mockito.mock(StorageProfileResourceApi.class); |
| 25 | + final UUID vaultId = UUID.randomUUID(); |
| 26 | + final StorageProfileAwsStaticSetup cli = new StorageProfileAwsStaticSetup(); |
| 27 | + cli.call(vaultId, api); |
| 28 | + |
| 29 | + final StorageProfileS3Dto dto = new StorageProfileS3Dto(); |
| 30 | + dto.setId(vaultId); |
| 31 | + dto.setName("AWS S3 static"); |
| 32 | + dto.setProtocol(Protocol.S3); |
| 33 | + dto.setArchived(false); |
| 34 | + dto.setScheme("https"); |
| 35 | + dto.setPort(443); |
| 36 | + dto.setWithPathStyleAccessEnabled(false); |
| 37 | + dto.setStorageClass(S3STORAGECLASSES.STANDARD); |
| 38 | + Mockito.verify(api, times(1)).apiStorageprofileS3Put(dto); |
| 39 | + Mockito.verify(api, times(1)).apiStorageprofileS3Put(any()); |
| 40 | + } |
| 41 | +} |
0 commit comments