Skip to content

Commit

Permalink
Add test.
Browse files Browse the repository at this point in the history
Former-commit-id: 88103dc34bcb886c753db5fbfe714924aa43296f
  • Loading branch information
dkocher committed Sep 15, 2013
1 parent fb2e93b commit 87028f4
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions test/ch/cyberduck/core/sftp/SFTPUnixPermissionFeatureTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,35 @@ public void testSetUnixPermission() throws Exception {
}

@Test
public void testRetainStickyBit() throws Exception {

public void testRetainStickyBits() throws Exception {
final Host host = new Host(new SFTPProtocol(), "test.cyberduck.ch", new Credentials(
properties.getProperty("sftp.user"), properties.getProperty("sftp.password")
));
final SFTPSession session = new SFTPSession(host);
session.open(new DefaultHostKeyController());
session.login(new DisabledPasswordStore(), new DisabledLoginController());
final Path test = new Path(new DefaultHomeFinderService(session).find(), UUID.randomUUID().toString(), Path.FILE_TYPE);
new SFTPTouchFeature(session).touch(test);
final SFTPUnixPermissionFeature feature = new SFTPUnixPermissionFeature(session);
feature.setUnixPermission(test,
new Permission(Permission.Action.all, Permission.Action.read, Permission.Action.read,
true, false, false));
assertEquals(new Permission(Permission.Action.all, Permission.Action.read, Permission.Action.read,
true, false, false), new SFTPListService(session).list(test.getParent(), new DisabledListProgressListener()).get(
test.getReference()).attributes().getPermission());
feature.setUnixPermission(test,
new Permission(Permission.Action.all, Permission.Action.read, Permission.Action.read,
false, true, false));
assertEquals(new Permission(Permission.Action.all, Permission.Action.read, Permission.Action.read,
false, true, false), new SFTPListService(session).list(test.getParent(), new DisabledListProgressListener()).get(
test.getReference()).attributes().getPermission());
feature.setUnixPermission(test,
new Permission(Permission.Action.all, Permission.Action.read, Permission.Action.read,
false, false, true));
assertEquals(new Permission(Permission.Action.all, Permission.Action.read, Permission.Action.read,
false, false, true), new SFTPListService(session).list(test.getParent(), new DisabledListProgressListener()).get(
test.getReference()).attributes().getPermission());
new SFTPDeleteFeature(session).delete(Collections.<Path>singletonList(test), new DisabledLoginController());
session.close();
}
}

0 comments on commit 87028f4

Please sign in to comment.