From bf45916088567e0268a985c258d60110ca5667d6 Mon Sep 17 00:00:00 2001 From: Josh Rabinowitz Date: Mon, 17 Jan 2022 09:54:18 -0500 Subject: [PATCH] add test by Emily-RoseSteyn, for #636 (#757) --- tests/test_remove.bats | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/test_remove.bats b/tests/test_remove.bats index 5f5563ce..524c4c41 100644 --- a/tests/test_remove.bats +++ b/tests/test_remove.bats @@ -111,3 +111,23 @@ function _has_line { run git secret remove -Z "$SECOND_FILE" [ "$status" -ne 0 ] } + +@test "run 'removeperson' with email added twice" { + local email="$TEST_DEFAULT_USER" + + # This should fail because you can't add the same email twice + run git secret tell "$email" + [ "$status" -ne 0 ] + + # Then test that the normal remove test runs + run git secret removeperson "$email" + [ "$status" -eq 0 ] + + # Testing output: + [[ "$output" == *"$email"* ]] + + # Then whoknows must return an error with status code 1, because no one is in list + run git secret whoknows + [ "$status" -eq 1 ] +} +