forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathletsencrypt.bats
137 lines (109 loc) · 3.03 KB
/
letsencrypt.bats
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/usr/bin/env bats
if [ "${PATH#*/usr/local/hestia/bin*}" = "$PATH" ]; then
. /etc/profile.d/hestia.sh
fi
load 'test_helper/bats-support/load'
load 'test_helper/bats-assert/load'
load 'test_helper/bats-file/load'
function random() {
head /dev/urandom | tr -dc 0-9 | head -c$1
}
function setup() {
source /tmp/hestia-le-env.sh
source $HESTIA/func/main.sh
source $HESTIA/conf/hestia.conf
source $HESTIA/func/ip.sh
}
@test "[ User ] Create new user" {
run v-add-user $user $user [email protected] default "Super Test"
assert_success
refute_output
}
@test "[ DNS ]Create DNS domain" {
run v-add-dns-domain $user $domain $ip
assert_success
refute_output
}
@test "[ Web ] Create web domain" {
run v-add-web-domain $user $domain $ip yes "www.$domain,renewal.$domain,foobar.$domain,bar.$domain"
assert_success
refute_output
}
@test "[ Web ] Create 2nd web domain" {
run v-add-web-domain $user "hestia.$domain" $ip yes
assert_success
refute_output
}
@test "[ Web ] Request new certificate for web domain" {
run v-add-letsencrypt-domain $user $domain "www.$domain,renewal.$domain,foobar.$domain,bar.$domain"
assert_success
refute_output
}
@test "[ Web ] Request 2nd new certificate for web domain" {
run v-add-letsencrypt-domain $user "hestia.$domain"
assert_success
refute_output
}
@test "[ Mail ] Create mail domain" {
run v-add-mail-domain $user $domain
assert_success
refute_output
}
@test "[ Mail ] Request new Certificate for Mail Domain" {
run v-add-letsencrypt-domain $user $domain "" "yes"
assert_success
refute_output
}
@test "[ All ] Run renewal script for LE" {
run v-update-letsencrypt-ssl
assert_success
refute_output
}
@test "[ All ] Remove alias and update ssl" {
run v-delete-web-domain-alias $user $domain bar.$domain
assert_success
refute_output
run v-update-letsencrypt-ssl
assert_success
refute_output
}
@test [ Web ] Delete web ssl" {
run v-delete-letsencrypt-domain $user $domain "yes"
assert_success
refute_output
}
@test [ Mail ] Delete mail ssl" {
run v-delete-letsencrypt-domain $user $domain "yes" "yes"
assert_success
refute_output
}
@test "[ Web ] Delete web domain" {
run v-delete-web-domain $user $domain "yes"
assert_success
refute_output
}
@test "[ Redirect ] Create web domain" {
run v-add-web-domain $user "redirect.$domain" $ip yes
assert_success
refute_output
}
@test "[ Redirect ] Add Domain redirect to other website" {
run v-add-web-domain-redirect $user "redirect.$domain" "https://hestiacp.com" 301 "yes"
assert_success
refute_output
}
@test "[ Redirect ] Request new certificate for web {
run v-add-letsencrypt-domain $user "redirect.$domain" ""
assert_success
refute_output
}
@test "[ Redirect ] Run renewal script for LE Redirected domain" {
run v-update-letsencrypt-ssl
assert_success
refute_output
}
@test "Delete user" {
run v-delete-user $user
assert_success
refute_output
}