From e83f83fa856fe88bec24d56dd7fa352e5def1073 Mon Sep 17 00:00:00 2001 From: Sascha Andres Date: Mon, 21 Oct 2019 17:00:21 +0200 Subject: [PATCH] MM-1946 Migrate tests from "web/web_test.go" to use testify #12794 (#12802) * MM-1946 Migrate tests from "web/web_test.go" to use testify #12794 Also changed call in commented out test for client. * refactor: re-introduce t.Run * Update web/web_test.go Co-Authored-By: Harrison Healey --- web/web_test.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/web/web_test.go b/web/web_test.go index f9c663ec81..6995ab1914 100644 --- a/web/web_test.go +++ b/web/web_test.go @@ -165,7 +165,7 @@ func TestPublicFilesRequest(t *testing.T) { func main() { plugin.ClientMain(&MyPlugin{}) } - + ` // Compile and write the plugin backend := filepath.Join(pluginDir, pluginID, "backend.exe") @@ -220,11 +220,8 @@ func TestStatic(t *testing.T) { resp, err := http.Get(URL + "/static/root.html") - if err != nil { - t.Fatalf("got error while trying to get static files %v", err) - } else if resp.StatusCode != http.StatusOK { - t.Fatalf("couldn't get static files %v", resp.StatusCode) - } + assert.NoErrorf(t, err, "got error while trying to get static files %v", err) + assert.Equalf(t, resp.StatusCode, http.StatusOK, "couldn't get static files %v", resp.StatusCode) } */ @@ -254,9 +251,8 @@ func TestCheckClientCompatability(t *testing.T) { } for _, browser := range uaTestParameters { t.Run(browser.Name, func(t *testing.T) { - if result := CheckClientCompatability(browser.UserAgent); result != browser.Result { - t.Fatalf("%s User Agent Test failed!", browser.Name) - } + result := CheckClientCompatability(browser.UserAgent) + require.Equalf(t, result, browser.Result, "user agent test failed for %s", browser.Name) }) } }