blob: 81a0e8844afd3f166d016fa6936583d9e2fe471f (
plain)
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
|
#! /usr/bin/env bats
# Copyright (C) 2017 Sebastian Pipping <sebastian@pipping.org>
# Licensed under the 3-Clause BSD license
_clear_state() {
rm -f /var/tmp/porticron.UPGRADE_MSG
rm -f /var/tmp/porticron.DIFF_MSG
}
setup() { _clear_state ; }
teardown() { _clear_state ; }
PORTICRON() {
DATE="$(cat test/data/date-r-output.txt)" \
EMERGE=test/mocks/emerge \
PORTDIR=/usr/portage \
GLSA_CHECK=/bin/true \
SENDMAIL=${SENDMAIL:-/bin/true} \
bin/porticron \
-c /dev/null \
"$@"
}
@test "Test emerge output goes into e-mail" {
output="$(SENDMAIL=cat PORTICRON)"
diff -u <(echo "${output}") test/data/expected-sendmail-input.txt
}
@test "Test no mail on matching hashes" {
output="$(PORTICRON -v 2>&1)"
diff -u <(echo "${output}") test/data/expected-porticron-v-output-fresh.txt
output="$(SENDMAIL=/bin/false PORTICRON -v 2>&1)"
diff -u <(echo "${output}") test/data/expected-porticron-v-output-unchanged.txt
}
|