New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
00-pre-revprop-change.t in vendors/t/svn-hooks – NEMO

source: vendors/t/svn-hooks/00-pre-revprop-change.t @ 10669

Last change on this file since 10669 was 10669, checked in by nicolasmartin, 5 years ago

Import latest FCM release from Github into the repository for testing

File size: 3.8 KB
Line 
1#!/bin/bash
2#-------------------------------------------------------------------------------
3# (C) British Crown Copyright 2006-17 Met Office.
4#
5# This file is part of FCM, tools for managing and building source code.
6#
7# FCM is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# FCM is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with FCM. If not, see <http://www.gnu.org/licenses/>.
19#-------------------------------------------------------------------------------
20# Basic tests for "pre-revprop-change".
21#-------------------------------------------------------------------------------
22. $(dirname $0)/test_header
23FCM_SVN_HOOK_ADMIN_EMAIL=your.admin.team
24. $TEST_SOURCE_DIR/test_header_more
25#-------------------------------------------------------------------------------
26tests 16
27#-------------------------------------------------------------------------------
28cp -p "$FCM_HOME/etc/svn-hooks/pre-revprop-change" "$REPOS_PATH/hooks/"
29echo Hello >file
30svn import -q -m'test' file "$REPOS_URL/file"
31#-------------------------------------------------------------------------------
32TEST_KEY=$TEST_KEY_BASE
33rm -f mail.out
34run_pass "$TEST_KEY" \
35    svn propset -q --revprop -r 1 'svn:log' 'Add hello file' "$REPOS_URL"
36run_fail "$TEST_KEY.mail.out" test -f mail.out
37#-------------------------------------------------------------------------------
38TEST_KEY=$TEST_KEY_BASE-bad-prop
39run_fail "$TEST_KEY" \
40    svn propset -q --revprop -r 1 'svn:author' 'boogeyman' "$REPOS_URL"
41file_grep "$TEST_KEY.err" \
42    "\[M svn:author\] permission denied." \
43    "$TEST_KEY.err"
44EXPR="\[! .....*-..-..T..:..:..Z\] $REPOS_PATH 1 $USER svn:author M"
45file_grep "$TEST_KEY.log" "$EXPR" "$REPOS_PATH/log/pre-revprop-change.log"
46file_grep "$TEST_KEY.mail.out" "$EXPR" mail.out
47#-------------------------------------------------------------------------------
48TEST_KEY=$TEST_KEY_BASE-bad-action
49run_fail "$TEST_KEY" \
50    svn propdel -q --revprop -r 1 'svn:log' "$REPOS_URL"
51file_grep "$TEST_KEY.err" \
52    "\[D svn:log\] permission denied. Can only do: \[M svn:log\]" \
53    "$TEST_KEY.err"
54EXPR="\[! .....*-..-..T..:..:..Z\] $REPOS_PATH 1 $USER svn:log D"
55file_grep "$TEST_KEY.log" "$EXPR" "$REPOS_PATH/log/pre-revprop-change.log"
56file_grep "$TEST_KEY.mail.out" "$EXPR" mail.out
57#-------------------------------------------------------------------------------
58TEST_KEY=$TEST_KEY_BASE-conf-bad
59cat >"$REPOS_PATH/hooks/pre-revprop-change-ok.conf" <<'__CONF__'
60M svn:author
61M svn:log
62__CONF__
63run_fail "$TEST_KEY" svn propdel -q --revprop -r 1 'svn:author' "$REPOS_URL"
64file_grep "$TEST_KEY.err" \
65    "\[D svn:author\] permission denied. Can only do: \[M svn:author\] \[M svn:log\]" \
66    "$TEST_KEY.err"
67EXPR="\[! .....*-..-..T..:..:..Z\] $REPOS_PATH 1 $USER svn:author D"
68file_grep "$TEST_KEY.log" "$EXPR" "$REPOS_PATH/log/pre-revprop-change.log"
69file_grep "$TEST_KEY.mail.out" "$EXPR" mail.out
70rm -f "$REPOS_PATH/hooks/pre-revprop-change-ok.conf"
71#-------------------------------------------------------------------------------
72TEST_KEY=$TEST_KEY_BASE-conf-good
73rm -f mail.out
74cat >"$REPOS_PATH/hooks/pre-revprop-change-ok.conf" <<'__CONF__'
75M svn:author
76M svn:log
77__CONF__
78run_pass "$TEST_KEY" \
79    svn propset -q --revprop -r 1 'svn:author' 'arthur' "$REPOS_URL"
80run_fail "$TEST_KEY.mail.out" test -f mail.out
81rm -f "$REPOS_PATH/hooks/pre-revprop-change-ok.conf"
82#-------------------------------------------------------------------------------
83exit
Note: See TracBrowser for help on using the repository browser.