package mongo_test import ( "testing" "fiskerinc.com/modules/mongo" "fiskerinc.com/modules/testhelper" ) func TestNewClient(t *testing.T) { _, err := mongo.NewClient(mongo.StandardDB) if err != nil { t.Errorf(testhelper.TestErrorTemplate, "TestNewClient", nil, err) } } func TestClientGetVehicles(t *testing.T) { client, err := mongo.NewClient(mongo.StandardDB) if err != nil { t.Errorf(testhelper.TestErrorTemplate, "TestClientGetVehicles", nil, err) } client.GetVehicles() } func TestClientSetVehicles(t *testing.T) { client, err := mongo.NewClient(mongo.StandardDB) if err != nil { t.Errorf(testhelper.TestErrorTemplate, "TestClientSetVehicles", nil, err) } client.SetVehicles(mongo.NewVehiclesCollection( mongo.NewCollection(client.Collection("vehicles")), )) } func TestClientGetFleets(t *testing.T) { client, err := mongo.NewClient(mongo.StandardDB) if err != nil { t.Errorf(testhelper.TestErrorTemplate, "TestClientGetFleets", nil, err) } client.GetFleets() } func TestClientSetFleets(t *testing.T) { client, err := mongo.NewClient(mongo.StandardDB) if err != nil { t.Errorf(testhelper.TestErrorTemplate, "TestClientSetFleets", nil, err) } client.SetFleets(mongo.NewFleetsCollection( mongo.NewCollection(client.Collection("fleets")), )) } func TestClientCollection(t *testing.T) { client, err := mongo.NewClient(mongo.StandardDB) if err != nil { t.Errorf(testhelper.TestErrorTemplate, "TestClientCollection", nil, err) return } c := client.Collection("test") if c == nil { t.Errorf(testhelper.TestErrorTemplate, "TestClientCollection", "*mongo.Collection", c) } } func TestClientClose(t *testing.T) { client, err := mongo.NewClient(mongo.StandardDB) if err != nil { t.Errorf(testhelper.TestErrorTemplate, "TestClientClose", nil, err) return } err = client.Close() if err != nil { t.Errorf(testhelper.TestErrorTemplate, "TestClientClose", nil, err) } }