Skip to content

Commit

Permalink
Added SSH key testing
Browse files Browse the repository at this point in the history
  • Loading branch information
dominusmars committed Feb 28, 2024
1 parent f0154ba commit ae825c6
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion tests/ssh.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeConnection } from "../src/modules/util/ssh_utils";
import { ejectSSHkey, makeConnection, removeSSHkey } from "../src/modules/util/ssh_utils";
import { computers, computerUsers } from "./computers";
import assert from "assert";

Expand All @@ -13,5 +13,24 @@ for (let computer of computers) {
assert.ok(ssh, "Unable to connect to target server");
if (ssh) await ssh.close();
});

it("Can deploy SSH key to Server", async () => {
let ssh = await makeConnection(user, 3000, 3);
if (!ssh) {
throw new Error("Unable to connect to target server");
}
let sshkey = await ejectSSHkey(ssh, computer["OS Type"]);
assert.ok(sshkey, "Unable to enject SSH key");
ssh.close();
it("Can remove SSH key to Server", async () => {
let ssh = await makeConnection(user, 3000, 3);
if (!ssh) {
throw new Error("Unable to connect to target server");
}
let sshkey = await removeSSHkey(ssh, computer["OS Type"]);
assert.ok(sshkey, "Unable to remove SSH key");
ssh.close();
});
});
});
}

0 comments on commit ae825c6

Please sign in to comment.