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 <harrisonmhealey@gmail.com>
This commit is contained in:
Sascha Andres
2019-10-21 17:00:21 +02:00
committed by Harrison Healey
parent 4c7220d69a
commit e83f83fa85

View File

@@ -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)
})
}
}