Enable browser support for gateway (#4425)

This commit is contained in:
poornas
2017-06-01 09:43:20 -07:00
committed by Harshavardhana
parent 64f4dbc272
commit 18c4e5d357
38 changed files with 260 additions and 146 deletions

View File

@@ -16,7 +16,10 @@
package cmd
import "testing"
import (
"os"
"testing"
)
// Test parseGatewayEndpoint
func TestParseGatewayEndpoint(t *testing.T) {
@@ -48,3 +51,25 @@ func TestParseGatewayEndpoint(t *testing.T) {
}
}
}
func TestSetBrowserFromEnv(t *testing.T) {
browser := os.Getenv("MINIO_BROWSER")
os.Setenv("MINIO_BROWSER", "on")
mustSetBrowserSettingFromEnv()
if globalIsBrowserEnabled != true {
t.Errorf("Expected the response status to be `%t`, but instead found `%t`", globalIsBrowserEnabled, false)
}
os.Setenv("MINIO_BROWSER", "off")
mustSetBrowserSettingFromEnv()
if globalIsBrowserEnabled != false {
t.Errorf("Expected the response status to be `%t`, but instead found `%t`", globalIsBrowserEnabled, true)
}
os.Setenv("MINIO_BROWSER", "")
mustSetBrowserSettingFromEnv()
if globalIsBrowserEnabled != false {
t.Errorf("Expected the response status to be `%t`, but instead found `%t`", globalIsBrowserEnabled, true)
}
os.Setenv("MINIO_BROWSER", browser)
}