Skip to content

Commit e95b020

Browse files
committed
[Tests] Extend web domain suspend/unsuspend test
1 parent 1091b5e commit e95b020

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

test/test.bats

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ function validate_web_domain() {
3636
local user=$1
3737
local domain=$2
3838
local webproof=$3
39+
local webpath=${4}
3940

4041
refute [ -z "$user" ]
4142
refute [ -z "$domain" ]
@@ -51,12 +52,14 @@ function validate_web_domain() {
5152
SSL=$(get_object_value 'web' 'DOMAIN' "$domain" '$SSL')
5253
domain_ip=$(get_real_ip "$domain_ip")
5354

54-
assert_file_exist $HOMEDIR/$user/web/$domain/public_html/index.php
55+
if [ ! -z $webpath ]; then
56+
assert_file_exist $HOMEDIR/$user/web/$domain/public_html/$webpath
57+
fi
5558

5659
refute [ -z "$webproof" ]
5760

5861
# Test HTTP
59-
run curl --location --silent --show-error --insecure --resolve "${domain}:80:${domain_ip}" "http://${domain}/index.php"
62+
run curl --location --silent --show-error --insecure --resolve "${domain}:80:${domain_ip}" "http://${domain}/${webpath}"
6063
assert_success
6164
assert_output --partial "$webproof"
6265

@@ -65,7 +68,7 @@ function validate_web_domain() {
6568
run v-list-web-domain-ssl $user $domain
6669
assert_success
6770

68-
run curl --location --silent --show-error --insecure --resolve "${domain}:443:${domain_ip}" "https://${domain}/index.php"
71+
run curl --location --silent --show-error --insecure --resolve "${domain}:443:${domain_ip}" "https://${domain}/${webpath}"
6972
assert_success
7073
assert_output --partial "$webproof"
7174
fi
@@ -369,6 +372,10 @@ function validate_web_domain() {
369372
run v-add-web-domain $user $domain 198.18.0.125
370373
assert_success
371374
refute_output
375+
376+
echo -e "<?php\necho 'Hestia Test:'.(4*3);" > $HOMEDIR/$user/web/$domain/public_html/php-test.php
377+
validate_web_domain $user $domain 'Hestia Test:12' 'php-test.php'
378+
rm $HOMEDIR/$user/web/$domain/public_html/php-test.php
372379
}
373380

374381
@test "WEB: Add web domain (duplicate)" {
@@ -404,12 +411,18 @@ function validate_web_domain() {
404411
run v-suspend-web-domain $user $domain
405412
assert_success
406413
refute_output
414+
415+
validate_web_domain $user $domain 'This site is currently suspended'
407416
}
408417

409418
@test "WEB: Unsuspend web domain" {
410419
run v-unsuspend-web-domain $user $domain
411420
assert_success
412421
refute_output
422+
423+
echo -e "<?php\necho 'Hestia Test:'.(4*3);" > $HOMEDIR/$user/web/$domain/public_html/php-test.php
424+
validate_web_domain $user $domain 'Hestia Test:12' 'php-test.php'
425+
rm $HOMEDIR/$user/web/$domain/public_html/php-test.php
413426
}
414427

415428
@test "WEB: Add ssl" {

0 commit comments

Comments
 (0)