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-basic.t in vendors/FCM-2017.10.0/t/fcm-add-trac-env – NEMO

source: vendors/FCM-2017.10.0/t/fcm-add-trac-env/00-basic.t @ 11668

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

Reimport latest FCM release

File size: 3.2 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 "fcm-add-trac-env".
21#-------------------------------------------------------------------------------
22. $(dirname $0)/test_header
23#-------------------------------------------------------------------------------
24if ! which trac-admin 1>/dev/null 2>/dev/null; then
25    skip_all 'trac-admin not available'
26fi
27tests 28
28#-------------------------------------------------------------------------------
29set -e
30mkdir -p etc srv/{svn,trac}
31# Configuration
32export FCM_CONF_PATH="$PWD/etc"
33ADMIN_USERS='holly ivy'
34cat >'etc/admin.cfg' <<__CONF__
35svn_live_dir=$PWD/srv/svn
36trac_admin_users=$ADMIN_USERS
37trac_live_dir=$PWD/srv/trac
38__CONF__
39# Create some Subversion repositories
40for NAME in bus lorry taxi; do
41    svnadmin create "srv/svn/$NAME"
42done
43set +e
44#-------------------------------------------------------------------------------
45for NAME in bus car lorry taxi; do
46    TEST_KEY="$TEST_KEY_BASE-$NAME"
47    # Command OK
48    run_pass "$TEST_KEY" "$FCM_HOME/sbin/fcm-add-trac-env" "$NAME"
49    # Trac environment directory exists
50    run_pass "$TEST_KEY-d" test -d "$PWD/srv/trac/$NAME"
51    # Admin users are set
52    trac-admin "$PWD/srv/trac/$NAME" 'permission' 'export' "$TEST_KEY-d-perms"
53    # For some reason, the "echo" for the next test is lost in the ether unless
54    # we have an "echo" here.
55    echo
56    for ADMIN_USER in $ADMIN_USERS; do
57        file_grep "$TEST_KEY-d-perms-$ADMIN_USER" \
58            "$ADMIN_USER,admin" "$TEST_KEY-d-perms"
59    done
60    file_grep "$TEST_KEY-d-perms-owner" "owner,TRAC_ADMIN" "$TEST_KEY-d-perms"
61    file_grep "$TEST_KEY-d-perms-admin" "admin,TRAC_ADMIN" "$TEST_KEY-d-perms"
62    # Subversion repository paths in place
63    if [[ -d "srv/svn/$NAME" ]]; then
64        file_grep "$TEST_KEY-repository_dir" \
65            "dir=$PWD/srv/svn/$NAME" \
66            "$PWD/srv/trac/$NAME/conf/trac.ini"
67    fi
68done
69
70TEST_KEY="$TEST_KEY_BASE-intertrac"
71file_cmp "$TEST_KEY" "$PWD/srv/trac/intertrac.ini" <<'__CONF__'
72[intertrac]
73bus.title=bus
74bus.url=https://localhost/trac/bus
75bus.compat=false
76car.title=car
77car.url=https://localhost/trac/car
78car.compat=false
79lorry.title=lorry
80lorry.url=https://localhost/trac/lorry
81lorry.compat=false
82taxi.title=taxi
83taxi.url=https://localhost/trac/taxi
84taxi.compat=false
85__CONF__
86#-------------------------------------------------------------------------------
87exit
Note: See TracBrowser for help on using the repository browser.