From 7004fa1efe4d0a6ae1f2365f5af1df693e44507e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Nieto?= <jose.carlos@menteslibres.net> Date: Sat, 6 Jun 2015 06:46:15 -0500 Subject: [PATCH] Fixing tests. --- mysql/database_test.go | 44 +++++++----------------------------------- 1 file changed, 7 insertions(+), 37 deletions(-) diff --git a/mysql/database_test.go b/mysql/database_test.go index 624dcc20..5fd4d163 100644 --- a/mysql/database_test.go +++ b/mysql/database_test.go @@ -145,7 +145,7 @@ func init() { nil, &tnz, nil, - int64(time.Second * 7331), + int64(time.Second * 1337), } if host = os.Getenv("TEST_HOST"); host == "" { @@ -615,35 +615,6 @@ func TestResultFetch(t *testing.T) { res.Close() - // Dumping into an struct with no tags. - rowStruct := struct { - ID uint64 - Name string - }{} - - res = artist.Find() - - for { - err = res.Next(&rowStruct) - - if err == db.ErrNoMoreRows { - break - } - - if err == nil { - if rowStruct.ID == 0 { - t.Fatalf("Expecting a not null ID.") - } - if rowStruct.Name == "" { - t.Fatalf("Expecting a name.") - } - } else { - t.Fatal(err) - } - } - - res.Close() - // Dumping into a tagged struct. rowStruct2 := struct { Value1 uint64 `db:"id"` @@ -673,7 +644,7 @@ func TestResultFetch(t *testing.T) { res.Close() - // Dumping into an slice of maps. + // Dumping into a slice of maps. allRowsMap := []map[string]interface{}{} res = artist.Find() @@ -692,10 +663,9 @@ func TestResultFetch(t *testing.T) { } // Dumping into an slice of structs. - allRowsStruct := []struct { - ID uint64 - Name string + ID uint64 `db:"id"` + Name string `db:"name"` }{} res = artist.Find() @@ -754,8 +724,8 @@ func TestUpdate(t *testing.T) { // Defining destination struct value := struct { - ID uint64 - Name string + ID uint64 `db:"id"` + Name string `db:"name"` }{} // Getting the first artist. @@ -786,7 +756,7 @@ func TestUpdate(t *testing.T) { // Updating set with a struct rowStruct := struct { - Name string + Name string `db:"name"` }{strings.ToLower(value.Name)} if err = res.Update(rowStruct); err != nil { -- GitLab