2016-02-21 13:26:17 +00:00
|
|
|
#!/usr/bin/env bats
|
|
|
|
|
|
|
|
load _test_base
|
|
|
|
|
|
|
|
|
|
|
|
function setup {
|
2016-05-29 10:56:48 +00:00
|
|
|
install_fixture_key "$TEST_DEFAULT_USER"
|
Version 0.2.2 pre-release
There are a lot of changes, multiple things were refactored: tests,
some commands, building and meta.
Several critical bugs fixed.
Changes:
1. Fixed #74, when `_user_required` was not working after reimporting keys
2. Closes #73, now it is possible to provide multiple emails to the `killperson` command
3. Closes #72, now it is possible to provide multiple emails to the `tell` command
4. Closes #71, now every doc in this project refer to `git-secret.io` instead of old `gh-pages` website
5. Closes #70, now installation section is removed from main `man` file
6. Closes #69, now "See also" section in the `man`s are clickable
7. Closes #61, added "Manual" section to the manuals
8. Refs #38, added `centos` Dockerfile, but `ci` testing is still failing
9. Refs #52, tests are refactored. Added `clean` command tests, removed a lot of hardcoded things, moved tests execution from `./temp` folder to `/tmp`, added a lot of new check in old tests, and some new test cases
10. Refactored `hide` and `clean` commands to be shorter
11. `shellcheck` is now supported with `make lint`
Additional features are not comming to 0.2.2 after this commit.
2017-02-26 13:38:46 +00:00
|
|
|
|
|
|
|
set_state_initial
|
2016-02-21 13:26:17 +00:00
|
|
|
set_state_git
|
|
|
|
set_state_secret_init
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function teardown {
|
|
|
|
uninstall_fixture_key "$TEST_DEFAULT_USER"
|
|
|
|
unset_current_state
|
|
|
|
}
|
|
|
|
|
2019-01-27 03:59:13 +00:00
|
|
|
@test "run 'tell' with '-v'" {
|
2019-10-09 18:05:31 +00:00
|
|
|
run git secret tell -d "$TEST_GPG_HOMEDIR" -v "$TEST_DEFAULT_USER"
|
2019-01-27 03:59:13 +00:00
|
|
|
#echo "$output" | sed "s/^/# '$BATS_TEST_DESCRIPTION' output: /" >&3
|
|
|
|
|
|
|
|
[[ "$output" == *"created"* ]]
|
|
|
|
[[ "$output" == *"gpg:"* ]]
|
|
|
|
[[ "$output" == *"$TEST_DEFAULT_USER"* ]]
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "run 'tell' without '-v'" {
|
2019-10-09 18:05:31 +00:00
|
|
|
run git secret tell -d "$TEST_GPG_HOMEDIR" "$TEST_DEFAULT_USER"
|
2019-01-27 03:59:13 +00:00
|
|
|
#echo "$output" | sed "s/^/# '$BATS_TEST_DESCRIPTION' output: /" >&3
|
|
|
|
|
|
|
|
[[ "$output" != *"imported:"* ]]
|
|
|
|
[[ "$output" == *"$TEST_DEFAULT_USER"* ]]
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
}
|
|
|
|
|
2018-09-25 21:08:44 +00:00
|
|
|
@test "run 'tell' on substring of emails" {
|
2019-10-09 18:05:31 +00:00
|
|
|
run git secret tell -d "$TEST_GPG_HOMEDIR" user
|
2018-09-25 21:08:44 +00:00
|
|
|
# this should give an error because there is no user named 'user',
|
|
|
|
# even though there are users with the substring 'user'.
|
|
|
|
# See issue https://github.com/sobolevn/git-secret/issues/176
|
|
|
|
[ "$status" -eq 1 ]
|
|
|
|
|
2019-10-09 18:05:31 +00:00
|
|
|
run git secret whoknows
|
2018-09-25 21:08:44 +00:00
|
|
|
[ "$status" -eq 1 ] # should error when there are no users told
|
|
|
|
|
|
|
|
}
|
2016-02-21 13:26:17 +00:00
|
|
|
|
Version 0.2.2 pre-release
There are a lot of changes, multiple things were refactored: tests,
some commands, building and meta.
Several critical bugs fixed.
Changes:
1. Fixed #74, when `_user_required` was not working after reimporting keys
2. Closes #73, now it is possible to provide multiple emails to the `killperson` command
3. Closes #72, now it is possible to provide multiple emails to the `tell` command
4. Closes #71, now every doc in this project refer to `git-secret.io` instead of old `gh-pages` website
5. Closes #70, now installation section is removed from main `man` file
6. Closes #69, now "See also" section in the `man`s are clickable
7. Closes #61, added "Manual" section to the manuals
8. Refs #38, added `centos` Dockerfile, but `ci` testing is still failing
9. Refs #52, tests are refactored. Added `clean` command tests, removed a lot of hardcoded things, moved tests execution from `./temp` folder to `/tmp`, added a lot of new check in old tests, and some new test cases
10. Refactored `hide` and `clean` commands to be shorter
11. `shellcheck` is now supported with `make lint`
Additional features are not comming to 0.2.2 after this commit.
2017-02-26 13:38:46 +00:00
|
|
|
@test "fail on no users" {
|
2019-10-09 18:05:31 +00:00
|
|
|
run _user_required
|
Version 0.2.2 pre-release
There are a lot of changes, multiple things were refactored: tests,
some commands, building and meta.
Several critical bugs fixed.
Changes:
1. Fixed #74, when `_user_required` was not working after reimporting keys
2. Closes #73, now it is possible to provide multiple emails to the `killperson` command
3. Closes #72, now it is possible to provide multiple emails to the `tell` command
4. Closes #71, now every doc in this project refer to `git-secret.io` instead of old `gh-pages` website
5. Closes #70, now installation section is removed from main `man` file
6. Closes #69, now "See also" section in the `man`s are clickable
7. Closes #61, added "Manual" section to the manuals
8. Refs #38, added `centos` Dockerfile, but `ci` testing is still failing
9. Refs #52, tests are refactored. Added `clean` command tests, removed a lot of hardcoded things, moved tests execution from `./temp` folder to `/tmp`, added a lot of new check in old tests, and some new test cases
10. Refactored `hide` and `clean` commands to be shorter
11. `shellcheck` is now supported with `make lint`
Additional features are not comming to 0.2.2 after this commit.
2017-02-26 13:38:46 +00:00
|
|
|
[ "$status" -eq 1 ]
|
2016-02-21 13:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Version 0.2.2 pre-release
There are a lot of changes, multiple things were refactored: tests,
some commands, building and meta.
Several critical bugs fixed.
Changes:
1. Fixed #74, when `_user_required` was not working after reimporting keys
2. Closes #73, now it is possible to provide multiple emails to the `killperson` command
3. Closes #72, now it is possible to provide multiple emails to the `tell` command
4. Closes #71, now every doc in this project refer to `git-secret.io` instead of old `gh-pages` website
5. Closes #70, now installation section is removed from main `man` file
6. Closes #69, now "See also" section in the `man`s are clickable
7. Closes #61, added "Manual" section to the manuals
8. Refs #38, added `centos` Dockerfile, but `ci` testing is still failing
9. Refs #52, tests are refactored. Added `clean` command tests, removed a lot of hardcoded things, moved tests execution from `./temp` folder to `/tmp`, added a lot of new check in old tests, and some new test cases
10. Refactored `hide` and `clean` commands to be shorter
11. `shellcheck` is now supported with `make lint`
Additional features are not comming to 0.2.2 after this commit.
2017-02-26 13:38:46 +00:00
|
|
|
@test "constantly fail on no users" {
|
|
|
|
# We had a serious bug with _user_required,
|
|
|
|
# see this link for the details:
|
|
|
|
# https://github.com/sobolevn/git-secret/issues/74
|
|
|
|
|
|
|
|
# Preparations:
|
|
|
|
git secret tell -d "$TEST_GPG_HOMEDIR" "$TEST_DEFAULT_USER"
|
|
|
|
git secret killperson "$TEST_DEFAULT_USER"
|
|
|
|
|
|
|
|
# It was showing something like `tru::1:1289775241:0:2:1:6`
|
|
|
|
# after the preparations done and the error was not generated.
|
2019-10-09 18:05:31 +00:00
|
|
|
run _user_required
|
2016-02-21 13:26:17 +00:00
|
|
|
[ "$status" -eq 1 ]
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@test "run 'tell' with secret-key imported" {
|
2017-03-05 21:46:49 +00:00
|
|
|
local secrets_dir_keys
|
|
|
|
secrets_dir_keys=$(_get_secrets_dir_keys)
|
|
|
|
|
|
|
|
local private_key="$secrets_dir_keys/secring.gpg"
|
2016-02-21 13:26:17 +00:00
|
|
|
echo "private key" > "$private_key"
|
|
|
|
[ -s "$private_key" ]
|
|
|
|
|
2019-10-09 18:05:31 +00:00
|
|
|
run git secret tell -d "$TEST_GPG_HOMEDIR" "$TEST_DEFAULT_USER"
|
2016-02-21 13:26:17 +00:00
|
|
|
[ "$status" -eq 1 ]
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@test "run 'tell' without '.gitsecret'" {
|
2017-03-05 21:46:49 +00:00
|
|
|
local secrets_dir
|
|
|
|
secrets_dir=$(_get_secrets_dir)
|
|
|
|
|
|
|
|
rm -r "$secrets_dir"
|
2016-02-21 13:26:17 +00:00
|
|
|
|
2019-10-09 18:05:31 +00:00
|
|
|
run git secret tell -d "$TEST_GPG_HOMEDIR" "$TEST_DEFAULT_USER"
|
2016-02-21 13:26:17 +00:00
|
|
|
[ "$status" -eq 1 ]
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@test "run 'tell' without arguments" {
|
2019-10-09 18:05:31 +00:00
|
|
|
run git secret tell
|
2016-02-21 13:26:17 +00:00
|
|
|
[ "$status" -eq 1 ]
|
|
|
|
}
|
|
|
|
|
2019-03-31 00:13:54 +00:00
|
|
|
@test "run 'init' with bad arg" {
|
2019-10-09 18:05:31 +00:00
|
|
|
run git secret tell -Z -d "$TEST_GPG_HOMEDIR" "$TEST_DEFAULT_USER"
|
2019-03-31 00:13:54 +00:00
|
|
|
[ "$status" -ne 0 ]
|
|
|
|
}
|
|
|
|
|
2016-02-21 13:26:17 +00:00
|
|
|
|
|
|
|
@test "run 'tell' normally" {
|
2019-10-09 18:05:31 +00:00
|
|
|
run git secret tell -d "$TEST_GPG_HOMEDIR" "$TEST_DEFAULT_USER"
|
2016-02-21 13:26:17 +00:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
|
Version 0.2.2 pre-release
There are a lot of changes, multiple things were refactored: tests,
some commands, building and meta.
Several critical bugs fixed.
Changes:
1. Fixed #74, when `_user_required` was not working after reimporting keys
2. Closes #73, now it is possible to provide multiple emails to the `killperson` command
3. Closes #72, now it is possible to provide multiple emails to the `tell` command
4. Closes #71, now every doc in this project refer to `git-secret.io` instead of old `gh-pages` website
5. Closes #70, now installation section is removed from main `man` file
6. Closes #69, now "See also" section in the `man`s are clickable
7. Closes #61, added "Manual" section to the manuals
8. Refs #38, added `centos` Dockerfile, but `ci` testing is still failing
9. Refs #52, tests are refactored. Added `clean` command tests, removed a lot of hardcoded things, moved tests execution from `./temp` folder to `/tmp`, added a lot of new check in old tests, and some new test cases
10. Refactored `hide` and `clean` commands to be shorter
11. `shellcheck` is now supported with `make lint`
Additional features are not comming to 0.2.2 after this commit.
2017-02-26 13:38:46 +00:00
|
|
|
# Testing that now user is found:
|
2019-10-09 18:05:31 +00:00
|
|
|
run _user_required
|
2016-02-21 13:26:17 +00:00
|
|
|
[ "$status" -eq 0 ]
|
Version 0.2.2 pre-release
There are a lot of changes, multiple things were refactored: tests,
some commands, building and meta.
Several critical bugs fixed.
Changes:
1. Fixed #74, when `_user_required` was not working after reimporting keys
2. Closes #73, now it is possible to provide multiple emails to the `killperson` command
3. Closes #72, now it is possible to provide multiple emails to the `tell` command
4. Closes #71, now every doc in this project refer to `git-secret.io` instead of old `gh-pages` website
5. Closes #70, now installation section is removed from main `man` file
6. Closes #69, now "See also" section in the `man`s are clickable
7. Closes #61, added "Manual" section to the manuals
8. Refs #38, added `centos` Dockerfile, but `ci` testing is still failing
9. Refs #52, tests are refactored. Added `clean` command tests, removed a lot of hardcoded things, moved tests execution from `./temp` folder to `/tmp`, added a lot of new check in old tests, and some new test cases
10. Refactored `hide` and `clean` commands to be shorter
11. `shellcheck` is now supported with `make lint`
Additional features are not comming to 0.2.2 after this commit.
2017-02-26 13:38:46 +00:00
|
|
|
|
|
|
|
# Testing that now user is in the list of people who knows the secret:
|
2019-10-09 18:05:31 +00:00
|
|
|
run git secret whoknows
|
Version 0.2.2 pre-release
There are a lot of changes, multiple things were refactored: tests,
some commands, building and meta.
Several critical bugs fixed.
Changes:
1. Fixed #74, when `_user_required` was not working after reimporting keys
2. Closes #73, now it is possible to provide multiple emails to the `killperson` command
3. Closes #72, now it is possible to provide multiple emails to the `tell` command
4. Closes #71, now every doc in this project refer to `git-secret.io` instead of old `gh-pages` website
5. Closes #70, now installation section is removed from main `man` file
6. Closes #69, now "See also" section in the `man`s are clickable
7. Closes #61, added "Manual" section to the manuals
8. Refs #38, added `centos` Dockerfile, but `ci` testing is still failing
9. Refs #52, tests are refactored. Added `clean` command tests, removed a lot of hardcoded things, moved tests execution from `./temp` folder to `/tmp`, added a lot of new check in old tests, and some new test cases
10. Refactored `hide` and `clean` commands to be shorter
11. `shellcheck` is now supported with `make lint`
Additional features are not comming to 0.2.2 after this commit.
2017-02-26 13:38:46 +00:00
|
|
|
[[ "$output" == *"$TEST_DEFAULT_USER"* ]]
|
2016-02-21 13:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Version 0.2.2 pre-release
There are a lot of changes, multiple things were refactored: tests,
some commands, building and meta.
Several critical bugs fixed.
Changes:
1. Fixed #74, when `_user_required` was not working after reimporting keys
2. Closes #73, now it is possible to provide multiple emails to the `killperson` command
3. Closes #72, now it is possible to provide multiple emails to the `tell` command
4. Closes #71, now every doc in this project refer to `git-secret.io` instead of old `gh-pages` website
5. Closes #70, now installation section is removed from main `man` file
6. Closes #69, now "See also" section in the `man`s are clickable
7. Closes #61, added "Manual" section to the manuals
8. Refs #38, added `centos` Dockerfile, but `ci` testing is still failing
9. Refs #52, tests are refactored. Added `clean` command tests, removed a lot of hardcoded things, moved tests execution from `./temp` folder to `/tmp`, added a lot of new check in old tests, and some new test cases
10. Refactored `hide` and `clean` commands to be shorter
11. `shellcheck` is now supported with `make lint`
Additional features are not comming to 0.2.2 after this commit.
2017-02-26 13:38:46 +00:00
|
|
|
@test "run 'tell' with '-m'" {
|
2018-09-25 21:08:44 +00:00
|
|
|
local email="$TEST_DEFAULT_USER"
|
2016-02-21 13:26:17 +00:00
|
|
|
|
|
|
|
git_set_config_email "$email"
|
2019-10-09 18:05:31 +00:00
|
|
|
run git secret tell -d "$TEST_GPG_HOMEDIR" -m
|
2016-02-21 13:26:17 +00:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Version 0.2.2 pre-release
There are a lot of changes, multiple things were refactored: tests,
some commands, building and meta.
Several critical bugs fixed.
Changes:
1. Fixed #74, when `_user_required` was not working after reimporting keys
2. Closes #73, now it is possible to provide multiple emails to the `killperson` command
3. Closes #72, now it is possible to provide multiple emails to the `tell` command
4. Closes #71, now every doc in this project refer to `git-secret.io` instead of old `gh-pages` website
5. Closes #70, now installation section is removed from main `man` file
6. Closes #69, now "See also" section in the `man`s are clickable
7. Closes #61, added "Manual" section to the manuals
8. Refs #38, added `centos` Dockerfile, but `ci` testing is still failing
9. Refs #52, tests are refactored. Added `clean` command tests, removed a lot of hardcoded things, moved tests execution from `./temp` folder to `/tmp`, added a lot of new check in old tests, and some new test cases
10. Refactored `hide` and `clean` commands to be shorter
11. `shellcheck` is now supported with `make lint`
Additional features are not comming to 0.2.2 after this commit.
2017-02-26 13:38:46 +00:00
|
|
|
@test "run 'tell' with '-m' (empty email)" {
|
2019-02-21 20:20:34 +00:00
|
|
|
# Preparations:
|
Version 0.2.2 pre-release
There are a lot of changes, multiple things were refactored: tests,
some commands, building and meta.
Several critical bugs fixed.
Changes:
1. Fixed #74, when `_user_required` was not working after reimporting keys
2. Closes #73, now it is possible to provide multiple emails to the `killperson` command
3. Closes #72, now it is possible to provide multiple emails to the `tell` command
4. Closes #71, now every doc in this project refer to `git-secret.io` instead of old `gh-pages` website
5. Closes #70, now installation section is removed from main `man` file
6. Closes #69, now "See also" section in the `man`s are clickable
7. Closes #61, added "Manual" section to the manuals
8. Refs #38, added `centos` Dockerfile, but `ci` testing is still failing
9. Refs #52, tests are refactored. Added `clean` command tests, removed a lot of hardcoded things, moved tests execution from `./temp` folder to `/tmp`, added a lot of new check in old tests, and some new test cases
10. Refactored `hide` and `clean` commands to be shorter
11. `shellcheck` is now supported with `make lint`
Additional features are not comming to 0.2.2 after this commit.
2017-02-26 13:38:46 +00:00
|
|
|
git_set_config_email "" # now it should not allow to add yourself
|
|
|
|
|
2019-10-09 18:05:31 +00:00
|
|
|
run git secret tell -d "$TEST_GPG_HOMEDIR" -m
|
2016-02-21 13:26:17 +00:00
|
|
|
[ "$status" -eq 1 ]
|
|
|
|
}
|
Version 0.2.2 pre-release
There are a lot of changes, multiple things were refactored: tests,
some commands, building and meta.
Several critical bugs fixed.
Changes:
1. Fixed #74, when `_user_required` was not working after reimporting keys
2. Closes #73, now it is possible to provide multiple emails to the `killperson` command
3. Closes #72, now it is possible to provide multiple emails to the `tell` command
4. Closes #71, now every doc in this project refer to `git-secret.io` instead of old `gh-pages` website
5. Closes #70, now installation section is removed from main `man` file
6. Closes #69, now "See also" section in the `man`s are clickable
7. Closes #61, added "Manual" section to the manuals
8. Refs #38, added `centos` Dockerfile, but `ci` testing is still failing
9. Refs #52, tests are refactored. Added `clean` command tests, removed a lot of hardcoded things, moved tests execution from `./temp` folder to `/tmp`, added a lot of new check in old tests, and some new test cases
10. Refactored `hide` and `clean` commands to be shorter
11. `shellcheck` is now supported with `make lint`
Additional features are not comming to 0.2.2 after this commit.
2017-02-26 13:38:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
@test "run 'tell' with multiple emails" {
|
|
|
|
# Preparations:
|
|
|
|
install_fixture_key "$TEST_SECOND_USER"
|
|
|
|
|
2019-02-21 20:20:34 +00:00
|
|
|
# Testing the command itself:
|
2019-10-09 18:05:31 +00:00
|
|
|
run git secret tell -d "$TEST_GPG_HOMEDIR" \
|
Version 0.2.2 pre-release
There are a lot of changes, multiple things were refactored: tests,
some commands, building and meta.
Several critical bugs fixed.
Changes:
1. Fixed #74, when `_user_required` was not working after reimporting keys
2. Closes #73, now it is possible to provide multiple emails to the `killperson` command
3. Closes #72, now it is possible to provide multiple emails to the `tell` command
4. Closes #71, now every doc in this project refer to `git-secret.io` instead of old `gh-pages` website
5. Closes #70, now installation section is removed from main `man` file
6. Closes #69, now "See also" section in the `man`s are clickable
7. Closes #61, added "Manual" section to the manuals
8. Refs #38, added `centos` Dockerfile, but `ci` testing is still failing
9. Refs #52, tests are refactored. Added `clean` command tests, removed a lot of hardcoded things, moved tests execution from `./temp` folder to `/tmp`, added a lot of new check in old tests, and some new test cases
10. Refactored `hide` and `clean` commands to be shorter
11. `shellcheck` is now supported with `make lint`
Additional features are not comming to 0.2.2 after this commit.
2017-02-26 13:38:46 +00:00
|
|
|
"$TEST_DEFAULT_USER" "$TEST_SECOND_USER"
|
|
|
|
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
|
|
|
|
# Testing that these users are presented in the
|
|
|
|
# list of people who knows secret:
|
2019-10-09 18:05:31 +00:00
|
|
|
run git secret whoknows
|
Version 0.2.2 pre-release
There are a lot of changes, multiple things were refactored: tests,
some commands, building and meta.
Several critical bugs fixed.
Changes:
1. Fixed #74, when `_user_required` was not working after reimporting keys
2. Closes #73, now it is possible to provide multiple emails to the `killperson` command
3. Closes #72, now it is possible to provide multiple emails to the `tell` command
4. Closes #71, now every doc in this project refer to `git-secret.io` instead of old `gh-pages` website
5. Closes #70, now installation section is removed from main `man` file
6. Closes #69, now "See also" section in the `man`s are clickable
7. Closes #61, added "Manual" section to the manuals
8. Refs #38, added `centos` Dockerfile, but `ci` testing is still failing
9. Refs #52, tests are refactored. Added `clean` command tests, removed a lot of hardcoded things, moved tests execution from `./temp` folder to `/tmp`, added a lot of new check in old tests, and some new test cases
10. Refactored `hide` and `clean` commands to be shorter
11. `shellcheck` is now supported with `make lint`
Additional features are not comming to 0.2.2 after this commit.
2017-02-26 13:38:46 +00:00
|
|
|
|
|
|
|
[[ "$output" == *"$TEST_DEFAULT_USER"* ]]
|
|
|
|
[[ "$output" == *"$TEST_SECOND_USER"* ]]
|
|
|
|
|
|
|
|
# Cleaning up:
|
|
|
|
uninstall_fixture_key "$TEST_SECOND_USER"
|
|
|
|
}
|
2017-03-05 21:46:49 +00:00
|
|
|
|
|
|
|
|
2019-09-07 00:21:50 +00:00
|
|
|
@test "run 'tell' with key without email and with comment" {
|
|
|
|
# install works because it works on filename, not contents of keychain
|
|
|
|
install_fixture_key "$TEST_NOEMAIL_COMMENT_USER"
|
|
|
|
|
|
|
|
# Testing the command itself fails because you have to use an email address
|
2019-10-09 18:05:31 +00:00
|
|
|
run git secret tell -d "$TEST_GPG_HOMEDIR" "$TEST_NOEMAIL_COMMENT_USER"
|
2019-09-07 00:21:50 +00:00
|
|
|
|
|
|
|
# this should not succeed because we only support addressing users by email
|
|
|
|
[ "$status" -ne 0 ]
|
|
|
|
|
|
|
|
# Testing that these users are presented in the
|
|
|
|
# list of people who knows secret:
|
2019-10-09 18:05:31 +00:00
|
|
|
run git secret whoknows
|
2019-09-07 00:21:50 +00:00
|
|
|
|
|
|
|
[[ "$output" != *"$TEST_NOEMAIL_COMMENT_USER"* ]]
|
|
|
|
|
|
|
|
# Cleaning up: can't clean up by email
|
|
|
|
#uninstall_fixture_key "$TEST_NOEMAIL_COMMENT_USER"
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "run 'tell' on non-email" {
|
|
|
|
install_fixture_key "$TEST_NOEMAIL_COMMENT_USER"
|
|
|
|
|
|
|
|
local name=$(echo "$TEST_NOEMAIL_COMMENT_USER" | sed -e 's/@.*//')
|
|
|
|
#echo "$name" | sed "s/^/# '$BATS_TEST_DESCRIPTION' name is: /" >&3
|
|
|
|
|
|
|
|
# Testing the command itself, should fail because you must use email
|
2019-10-09 18:05:31 +00:00
|
|
|
run git secret tell -d "$TEST_GPG_HOMEDIR" "$name"
|
2019-09-07 00:21:50 +00:00
|
|
|
|
|
|
|
# this should not succeed because we only support addressing users by email
|
|
|
|
[ "$status" -ne 0 ]
|
|
|
|
|
|
|
|
# Testing that these users are presented in the
|
|
|
|
# list of people who knows secret:
|
2019-10-09 18:05:31 +00:00
|
|
|
run git secret whoknows
|
2019-09-07 00:21:50 +00:00
|
|
|
|
|
|
|
[[ "$output" != *"$name"* ]]
|
|
|
|
|
|
|
|
# Cleaning up: can't clean up by email because key doesn't hold it
|
|
|
|
#uninstall_fixture_key "$TEST_NOEMAIL_COMMENT_USER"
|
|
|
|
}
|
|
|
|
|
2017-03-05 21:46:49 +00:00
|
|
|
@test "run 'tell' in subfolder" {
|
|
|
|
if [[ "$BATS_RUNNING_FROM_GIT" -eq 1 ]]; then
|
2019-02-10 21:44:21 +00:00
|
|
|
skip "this test is skipped while 'git commit'. See #334"
|
2017-03-05 21:46:49 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Preparations
|
|
|
|
local root_dir='test_dir'
|
|
|
|
local test_dir="$root_dir/telling"
|
|
|
|
local current_dir=$(pwd)
|
|
|
|
|
|
|
|
mkdir -p "$test_dir"
|
|
|
|
cd "$test_dir"
|
|
|
|
|
|
|
|
# Test:
|
2019-10-09 18:05:31 +00:00
|
|
|
run git secret tell -d "$TEST_GPG_HOMEDIR" "$TEST_DEFAULT_USER"
|
2017-03-05 21:46:49 +00:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
|
|
|
|
# Testing that now user is found:
|
2019-10-09 18:05:31 +00:00
|
|
|
run _user_required
|
2017-03-05 21:46:49 +00:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
|
|
|
|
# Testing that now user is in the list of people who knows the secret:
|
2019-10-09 18:05:31 +00:00
|
|
|
run git secret whoknows
|
2017-03-05 21:46:49 +00:00
|
|
|
[[ "$output" == *"$TEST_DEFAULT_USER"* ]]
|
|
|
|
|
|
|
|
# Cleaning up:
|
|
|
|
cd "$current_dir"
|
|
|
|
rm -r "$root_dir"
|
|
|
|
}
|