Skip to content

Commit

Permalink
Review tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
dkocher committed Dec 18, 2024
1 parent 89b743a commit 8fb5257
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion cli/src/test/java/ch/cyberduck/cli/TerminalUploadTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void testUploadEncryptedRoom() throws Exception {
assertEquals(Terminal.Exit.success, terminal.execute(new DisabledLoginCallback() {
@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
}));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public void warn(final Host bookmark, final String title, final String message,

@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
}, new DisabledStreamListener());
assertNotNull(copy.attributes().getVersionId());
Expand All @@ -235,7 +235,7 @@ public void warn(final Host bookmark, final String title, final String message,

@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
});
IOUtils.readFully(stream, compare);
Expand Down Expand Up @@ -276,7 +276,7 @@ public void warn(final Host bookmark, final String title, final String message,

@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
});
IOUtils.readFully(stream, compare);
Expand Down Expand Up @@ -317,7 +317,7 @@ public void warn(final Host bookmark, final String title, final String message,

@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
}, new DisabledStreamListener()).attributes().getVersionId());
assertFalse(proxy.isSupported(test, target));
Expand All @@ -333,7 +333,7 @@ public void warn(final Host bookmark, final String title, final String message,

@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
});
IOUtils.readFully(stream, compare);
Expand Down Expand Up @@ -375,7 +375,7 @@ public void warn(final Host bookmark, final String title, final String message,

@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
}, new DisabledStreamListener());
assertNotNull(copy.attributes().getVersionId());
Expand All @@ -390,7 +390,7 @@ public void warn(final Host bookmark, final String title, final String message,

@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
});
IOUtils.readFully(stream, compare);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public void warn(final Host bookmark, final String title, final String message,

@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
});
test.attributes().setVersionId(null);
Expand All @@ -176,7 +176,7 @@ public void warn(final Host bookmark, final String title, final String message,

@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
});
IOUtils.readFully(stream, compare);
Expand Down Expand Up @@ -214,7 +214,7 @@ public void warn(final Host bookmark, final String title, final String message,

@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
});
IOUtils.readFully(stream, compare);
Expand Down Expand Up @@ -252,7 +252,7 @@ public void warn(final Host bookmark, final String title, final String message,

@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
});
test.attributes().setVersionId(null);
Expand All @@ -267,7 +267,7 @@ public void warn(final Host bookmark, final String title, final String message,

@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
});
IOUtils.readFully(stream, compare);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public void testWriteEncrypted() throws Exception {
final InputStream stream = new TripleCryptReadFeature(session, nodeid, new SDSReadFeature(session, nodeid)).read(test, new TransferStatus().withLength(content.length), new DisabledConnectionCallback() {
@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
});
IOUtils.readFully(stream, compare);
Expand All @@ -181,7 +181,7 @@ public Credentials prompt(final Host bookmark, final String title, final String
new TripleCryptReadFeature(session, nodeid, new SDSReadFeature(session, nodeid)).read(test, new TransferStatus(), new DisabledConnectionCallback() {
@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
});
fail();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public void testTripleCryptUploadBelowMultipartSize() throws Exception {
final InputStream stream = new TripleCryptReadFeature(session, nodeid, new SDSReadFeature(session, nodeid)).read(test, new TransferStatus(), new DisabledConnectionCallback() {
@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
});
IOUtils.readFully(stream, compare);
Expand Down Expand Up @@ -278,7 +278,7 @@ public void testTripleCryptUploadExactMultipartSize() throws Exception {
final InputStream stream = new TripleCryptReadFeature(session, nodeid, new SDSReadFeature(session, nodeid)).read(test, new TransferStatus(), new DisabledConnectionCallback() {
@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
});
IOUtils.readFully(stream, compare);
Expand Down Expand Up @@ -317,7 +317,7 @@ public void testTripleCryptUploadMultipleParts() throws Exception {
final InputStream stream = new TripleCryptReadFeature(session, nodeid, new SDSReadFeature(session, nodeid)).read(test, new TransferStatus(), new DisabledConnectionCallback() {
@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
});
IOUtils.readFully(stream, compare);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void testMissingKeys() throws Exception {
final List<UserFileKeySetRequest> processed = background.operate(new DisabledPasswordCallback() {
@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
});
assertTrue(processed.stream().filter(userFileKeySetRequest -> userFileKeySetRequest.getFileId().equals(Long.parseLong(test.attributes().getVersionId()))).findAny().isPresent());
Expand Down Expand Up @@ -132,7 +132,7 @@ public void testFileKeyMigration() throws Exception {
this.removeKeyPairs(userApi);
session.resetUserKeyPairs();
// create legacy and new crypto key pair
final UserKeyPair deprecated = Crypto.generateUserKeyPair(UserKeyPair.Version.RSA2048, "eth[oh8uv4Eesij".toCharArray());
final UserKeyPair deprecated = Crypto.generateUserKeyPair(UserKeyPair.Version.RSA2048, PROPERTIES.get("vault.passphrase").toCharArray());
userApi.setUserKeyPair(TripleCryptConverter.toSwaggerUserKeyPairContainer(deprecated), null);
List<UserKeyPairContainer> keyPairs = userApi.requestUserKeyPairs(null, null);
assertEquals(1, keyPairs.size());
Expand All @@ -152,7 +152,7 @@ public void testFileKeyMigration() throws Exception {
session.unlockTripleCryptKeyPair(new DisabledLoginCallback() {
@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) throws LoginCanceledException {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
}, session.userAccount(), UserKeyPair.Version.RSA4096);
keyPairs = userApi.requestUserKeyPairs(null, null);
Expand All @@ -164,7 +164,7 @@ public Credentials prompt(final Host bookmark, final String title, final String
final List<UserFileKeySetRequest> processed = background.operate(new DisabledPasswordCallback() {
@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
});
assertFalse(processed.isEmpty());
Expand All @@ -179,7 +179,7 @@ public Credentials prompt(final Host bookmark, final String title, final String
final List<UserFileKeySetRequest> empty = new SDSMissingFileKeysSchedulerFeature(session, nodeid).operate(new DisabledPasswordCallback() {
@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
});
assertTrue(empty.isEmpty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,15 @@ public void testKeyPairMigration() throws Exception {
}
}
// create legacy key pair
final UserKeyPair userKeyPair = Crypto.generateUserKeyPair(UserKeyPair.Version.RSA2048, "eth[oh8uv4Eesij".toCharArray());
final UserKeyPair userKeyPair = Crypto.generateUserKeyPair(UserKeyPair.Version.RSA2048, PROPERTIES.get("vault.passphrase").toCharArray());
userApi.setUserKeyPair(TripleCryptConverter.toSwaggerUserKeyPairContainer(userKeyPair), null);
List<UserKeyPairContainer> keyPairs = userApi.requestUserKeyPairs(null, null);
assertEquals(1, keyPairs.size());
// Start migration
session.unlockTripleCryptKeyPair(new DisabledLoginCallback() {
@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) throws LoginCanceledException {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
}, session.userAccount(), UserKeyPair.Version.RSA4096);
keyPairs = userApi.requestUserKeyPairs(null, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ Share.Sharee.world, new CreateDownloadShareRequest()
.maxDownloads(null), new DisabledPasswordCallback() {
@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
});
assertNotEquals(DescriptiveUrl.EMPTY, url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void warn(final Host bookmark, final String title, final String message,

@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
});
stream.skip(1000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void warn(final Host bookmark, final String title, final String message,

@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
});
IOUtils.readFully(stream, compare);
Expand Down Expand Up @@ -133,7 +133,7 @@ public void warn(final Host bookmark, final String title, final String message,

@Override
public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
return new VaultCredentials("eth[oh8uv4Eesij");
return new VaultCredentials(PROPERTIES.get("vault.passphrase"));
}
});
IOUtils.readFully(stream, compare);
Expand Down

0 comments on commit 8fb5257

Please sign in to comment.