require "vnd.dovecot.testsuite";
require "vnd.dovecot.environment";
require "variables";

test "default-mailbox" {
	if not environment :is "vnd.dovecot.default-mailbox" "INBOX" {
		if environment :matches "vnd.dovecot.default-mailbox" "*" { set "env" "${1}"; }

		test_fail "vnd.dovecot.default-mailbox environment returned invalid value(1): `${env}'";
	}
}

test "username" {
	if not environment :contains "vnd.dovecot.username" "" {
		test_fail "vnd.dovecot.username environment does not exist";
	}
}

test_config_set "sieve_env_display_name" "Jan Jansen";
test_config_reload :extension "vnd.dovecot.environment";

test "config" {
	if not environment :contains "vnd.dovecot.config.display_name" "" {
		test_fail "vnd.dovecot.config.display_name environment does not exist";
	}
	if not environment :is "vnd.dovecot.config.display_name" "Jan Jansen" {
		test_fail "vnd.dovecot.config.display_name environment has wrong value";
	}
}
