From 378e3c79ec920d2169786bbcf81efec1cb576a58 Mon Sep 17 00:00:00 2001 From: Bob McHenry Date: Thu, 29 Feb 2024 09:05:36 -0800 Subject: [PATCH] Update test data yaml in e2e test --- tests/end-to-end/testpreservehooks.bats | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/end-to-end/testpreservehooks.bats b/tests/end-to-end/testpreservehooks.bats index 6f92ed2c..17921df2 100644 --- a/tests/end-to-end/testpreservehooks.bats +++ b/tests/end-to-end/testpreservehooks.bats @@ -1,18 +1,26 @@ +# Test to ensure pre-exisiting hooks within the .pre-commit-config.yaml files +# are persisted when installing secureli + MOCK_REPO='tests/test-data/mock-repo' setup() { load "${BATS_LIBS_ROOT}/bats-support/load" load "${BATS_LIBS_ROOT}/bats-assert/load" mkdir -p $MOCK_REPO - echo '# Ive been here the whole time!' > $MOCK_REPO/.pre-commit-config.yaml + echo '# Existing YAML Contents should persist' > $MOCK_REPO/.pre-commit-config.yaml + echo 'repos:' >> $MOCK_REPO/.pre-commit-config.yaml + echo '- repo: https://github.com/hhatto/autopep8' + echo ' rev: v2.0.4' >> $MOCK_REPO/.pre-commit-config.yaml + echo ' hooks:' >> $MOCK_REPO/.pre-commit-config.yaml + echo ' - id: autopep8' >> $MOCK_REPO/.pre-commit-config.yaml echo 'print("hello world!")' > $MOCK_REPO/hw.py run git init $MOCK_REPO } @test "can preserve pre-existing hooks" { run python secureli/main.py init -y --directory $MOCK_REPO - run grep '# Ive been here the whole time!' $MOCK_REPO/.secureli/.pre-commit-config.yaml - assert_output --partial '# Ive been here the whole time!' + run grep '# Existing YAML Contents should persist' $MOCK_REPO/.secureli/.pre-commit-config.yaml + assert_output --partial '# Existing YAML Contents should persist' } teardown() {