Browse Source

added edit credential menu item

feature-vault
fdai6352 3 years ago
parent
commit
cf0425bc59
  1. 5
      src/main/java/Vault.java
  2. 9
      src/test/java/VaultTest.java

5
src/main/java/Vault.java

@ -56,7 +56,7 @@ public class Vault implements VaultInterface {
} else if (input.equals("n")) { } else if (input.equals("n")) {
println("Should you PW have numbers? Type in yes or no."); println("Should you PW have numbers? Type in yes or no.");
String inputN = scan.nextLine(); String inputN = scan.nextLine();
setNumbers(input);
setNumbers(inputN);
} }
} }
@ -129,6 +129,7 @@ public class Vault implements VaultInterface {
sbcm.append("Configure credentials:\n"); sbcm.append("Configure credentials:\n");
sbcm.append("- add credential: a\n"); sbcm.append("- add credential: a\n");
sbcm.append("- show credential: c\n"); sbcm.append("- show credential: c\n");
sbcm.append("- edit credential: l\n");
sbcm.append("- exit: e\n"); sbcm.append("- exit: e\n");
println(sbcm.toString()); println(sbcm.toString());
@ -141,6 +142,8 @@ public class Vault implements VaultInterface {
println("Type username:"); println("Type username:");
} else if (input.equals("c")) { } else if (input.equals("c")) {
println("Type username or ID to show credential:"); println("Type username or ID to show credential:");
} else if (input.equals("l")) {
println("Type username or ID to select credential:");
} }
} }
} }

9
src/test/java/VaultTest.java

@ -62,6 +62,15 @@ public class VaultTest {
assertTrue(outputStream.toString().contains("Type")); assertTrue(outputStream.toString().contains("Type"));
} }
@Test
void openEditCredentialMenuItem() {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
vlt.inputS = new ByteArrayInputStream("l".getBytes(StandardCharsets.UTF_8));
vlt.outputS = outputStream;
vlt.credentialMenu();
assertTrue(outputStream.toString().contains("Type"));
}
@Test @Test
void addCredentialTest() { vlt.addCredential();} void addCredentialTest() { vlt.addCredential();}

Loading…
Cancel
Save