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
| ... | ... |
@@ -245,4 +245,33 @@ else |
| 245 | 245 |
passed "OK" |
| 246 | 246 |
fi |
| 247 | 247 |
|
| 248 |
+function test_export_proxy_variables {
|
|
| 249 |
+ echo "Testing export_proxy_variables()" |
|
| 250 |
+ |
|
| 251 |
+ local expected results |
|
| 252 |
+ |
|
| 253 |
+ http_proxy=http_proxy_test |
|
| 254 |
+ https_proxy=https_proxy_test |
|
| 255 |
+ no_proxy=no_proxy_test |
|
| 256 |
+ |
|
| 257 |
+ export_proxy_variables |
|
| 258 |
+ expected=$(echo -e "http_proxy=$http_proxy\nhttps_proxy=$https_proxy\nno_proxy=$no_proxy") |
|
| 259 |
+ results=$(env | egrep '(http(s)?|no)_proxy=') |
|
| 260 |
+ if [[ $expected = $results ]]; then |
|
| 261 |
+ passed "OK: Proxy variables are exported when proxy variables are set" |
|
| 262 |
+ else |
|
| 263 |
+ failed "Expected: $expected, Failed: $results" |
|
| 264 |
+ fi |
|
| 265 |
+ |
|
| 266 |
+ unset http_proxy https_proxy no_proxy |
|
| 267 |
+ export_proxy_variables |
|
| 268 |
+ results=$(env | egrep '(http(s)?|no)_proxy=') |
|
| 269 |
+ if [[ "" = $results ]]; then |
|
| 270 |
+ passed "OK: Proxy variables aren't exported when proxy variables aren't set" |
|
| 271 |
+ else |
|
| 272 |
+ failed "Expected: '', Failed: $results" |
|
| 273 |
+ fi |
|
| 274 |
+} |
|
| 275 |
+test_export_proxy_variables |
|
| 276 |
+ |
|
| 248 | 277 |
report_results |