Skip to content

Commit aee0816

Browse files
committed
Add assertions.
1 parent 6d84579 commit aee0816

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

admin-cli/src/test/java/cloud/katta/cli/commands/hub/StorageProfileArchiveIT.java

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,49 @@
77

88
import ch.cyberduck.core.PasswordStoreFactory;
99

10+
import cloud.katta.client.model.StorageProfileS3Dto;
11+
1012
import org.apache.logging.log4j.LogManager;
1113
import org.apache.logging.log4j.Logger;
1214
import org.junit.jupiter.api.Test;
1315
import org.testcontainers.containers.ComposeContainer;
1416

17+
import cloud.katta.client.api.StorageProfileResourceApi;
1518
import cloud.katta.protocols.hub.HubSession;
1619
import cloud.katta.testsetup.HubTestConfig;
1720

21+
import static org.junit.Assert.assertFalse;
22+
import static org.junit.jupiter.api.Assertions.assertTrue;
23+
24+
import java.util.List;
25+
import java.util.Optional;
26+
1827
class StorageProfileArchiveIT extends AbtractAdminCliIT {
1928
private static final Logger log = LogManager.getLogger(StorageProfileArchiveIT.class.getName());
2029
public static ComposeContainer compose;
2130

2231

2332
@Test
24-
public void testHubWorkflow() throws Exception {
33+
public void testStorageProfileArchive() throws Exception {
2534
HubTestConfig.Setup config = new HubTestConfig.Setup().withUserConfig(
2635
new HubTestConfig.Setup.UserConfig("admin", "admin", "setupcode")
2736
).withHubURL("http://localhost:8280");
2837
final HubSession hubSession = setupConnection(config);
2938
final String accessToken = PasswordStoreFactory.get().findOAuthTokens(hubSession.getHost()).getAccessToken();
3039

31-
new StorageProfileArchive().call("http://localhost:8280", accessToken, "732D43FA-3716-46C4-B931-66EA5405EF1C");
40+
41+
final String storageProfileId = "732D43FA-3716-46C4-B931-66EA5405EF1C".toLowerCase();
42+
final StorageProfileResourceApi storageProfileResourceApi = new StorageProfileResourceApi(hubSession.getClient());
43+
{
44+
final Optional<StorageProfileS3Dto> profile = storageProfileResourceApi.apiStorageprofileS3Get().stream().filter(p -> p.getId().toString().toLowerCase().equals(storageProfileId)).findFirst();
45+
assertTrue(profile.isPresent());
46+
assertFalse(profile.get().getArchived());
47+
}
48+
new StorageProfileArchive().call("http://localhost:8280", accessToken, storageProfileId);
49+
{
50+
final Optional<StorageProfileS3Dto> profile = storageProfileResourceApi.apiStorageprofileS3Get().stream().filter(p -> p.getId().toString().toLowerCase().equals(storageProfileId)).findFirst();
51+
assertTrue(profile.isPresent());
52+
assertTrue(profile.get().getArchived());
53+
}
3254
}
3355
}

0 commit comments

Comments
 (0)