]> git.scottworley.com Git - pinch/commitdiff
Verify update fails if run before pin
authorScott Worley <scottworley@scottworley.com>
Fri, 29 May 2020 06:16:50 +0000 (23:16 -0700)
committerScott Worley <scottworley@scottworley.com>
Fri, 29 May 2020 06:16:50 +0000 (23:16 -0700)
tests/reject-partially-unpinned.sh [new file with mode: 0755]
tests/reject-unpinned.sh [new file with mode: 0755]

diff --git a/tests/reject-partially-unpinned.sh b/tests/reject-partially-unpinned.sh
new file mode 100755 (executable)
index 0000000..5fc61fd
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+. ./tests/lib/test-setup.sh
+
+foo_setup
+
+python3 ./pinch.py pin "$conf"
+
+cat >> "$conf" <<EOF
+[bar]
+git_repo = file://$repo
+git_ref = master
+EOF
+
+grep . "$conf"
+
+if python3 ./pinch.py update --dry-run "$conf";then
+  echo "FAIL: Update on an unpinned file should fail"
+  exit 1
+else
+  echo PASS
+fi
diff --git a/tests/reject-unpinned.sh b/tests/reject-unpinned.sh
new file mode 100755 (executable)
index 0000000..be7357e
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+. ./tests/lib/test-setup.sh
+
+foo_setup
+
+if python3 ./pinch.py update --dry-run "$conf";then
+  echo "FAIL: Update on an unpinned file should fail"
+  exit 1
+else
+  echo PASS
+fi