-
Notifications
You must be signed in to change notification settings - Fork 2
/
test_example4.sh
87 lines (67 loc) · 1.82 KB
/
test_example4.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/sh
# file: tests/test_examples.sh
# This tests the virtstrap examples
. ./setup.sh
TEST_DIR=`pwd`
EXAMPLE4_DIR=$TEST_DIR/../examples/example4
oneTimeSetUp() {
# Run virtstrap in the directory
$VSTRAP_BIN init $EXAMPLE4_DIR
}
oneTimeTearDown() {
# Clean up that directory
$PYTHON_BIN cleandir.py $EXAMPLE4_DIR
}
setUp() {
# Make sure the environment variables to test are not set
unset DG_A
unset DG_B
unset DG_C
unset DG_D
unset DG_E
cd $EXAMPLE4_DIR
}
tearDown() {
cd $TEST_DIR
}
testActivateDevelopmentEnvironment() {
. ./quickactivate
assertSame "A" "$DG_A"
assertSame "B" "$DG_B"
assertSame "C" "$DG_C"
assertSame "E" "$DG_E"
deactivate
assertNull "DG_A should be null" "$DG_A"
assertNull "DG_B should be null" "$DG_B"
assertNull "DG_C should be null" "$DG_C"
assertNull "DG_C should be null" "$DG_E"
}
testActivateProductionEnvironment() {
. ./quickactivate production
assertSame "OA" "$DG_A"
assertSame "B" "$DG_B"
assertSame "OC" "$DG_C"
assertSame "D" "$DG_D"
assertNull "DG_E should be null" "$DG_E"
deactivate
assertNull "DG_A should be null" "$DG_A"
assertNull "DG_B should be null" "$DG_B"
assertNull "DG_C should be null" "$DG_C"
assertNull "DG_D should be null" "$DG_D"
assertNull "DG_E should be null" "$DG_E"
}
testActivateTwoEnvironments() {
. ./quickactivate development,production
assertSame "OA" "$DG_A"
assertSame "B" "$DG_B"
assertSame "OC" "$DG_C"
assertSame "D" "$DG_D"
assertSame "E" "$DG_E"
deactivate
assertNull "DG_A should be null" "$DG_A"
assertNull "DG_B should be null" "$DG_B"
assertNull "DG_C should be null" "$DG_C"
assertNull "DG_D should be null" "$DG_D"
assertNull "DG_E should be null" "$DG_E"
}
. ./shunit2