From 54dc19ecad2ed06694a4b6269c2833d9533a26f5 Mon Sep 17 00:00:00 2001 From: Mahito OGURA Date: Tue, 14 Jul 2015 17:16:42 +0900 Subject: [PATCH] Add export_proxy_variables() tests to test_functions.sh In test_functions.sh, There aren't export_proxy_variables() tests. This patch add test of export_proxy_variables to test_funstions.sh. Change-Id: I76f2bab84f4019961e612b0bff0ab66646b6e160 --- tests/test_functions.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/test_functions.sh b/tests/test_functions.sh index f555de8dff..be8dc5e287 100755 --- a/tests/test_functions.sh +++ b/tests/test_functions.sh @@ -245,4 +245,33 @@ else passed "OK" fi +function test_export_proxy_variables { + echo "Testing export_proxy_variables()" + + local expected results + + http_proxy=http_proxy_test + https_proxy=https_proxy_test + no_proxy=no_proxy_test + + export_proxy_variables + expected=$(echo -e "http_proxy=$http_proxy\nhttps_proxy=$https_proxy\nno_proxy=$no_proxy") + results=$(env | egrep '(http(s)?|no)_proxy=') + if [[ $expected = $results ]]; then + passed "OK: Proxy variables are exported when proxy variables are set" + else + failed "Expected: $expected, Failed: $results" + fi + + unset http_proxy https_proxy no_proxy + export_proxy_variables + results=$(env | egrep '(http(s)?|no)_proxy=') + if [[ "" = $results ]]; then + passed "OK: Proxy variables aren't exported when proxy variables aren't set" + else + failed "Expected: '', Failed: $results" + fi +} +test_export_proxy_variables + report_results