func TestTableStoreSliceIDs(t *testing.T) { ids := testStores.IDs() assert.NotNil(t, ids) assert.Equal(t, utils.Int64Slice{0, 5, 1, 4, 2, 6, 3}, ids) var ts = store.TableStoreSlice{} assert.Nil(t, ts.IDs()) }
func TestTableStoreSliceCodes(t *testing.T) { codes := testStores.Codes() assert.NotNil(t, codes) assert.Equal(t, utils.StringSlice{"admin", "au", "de", "uk", "at", "nz", "ch"}, codes) var ts = store.TableStoreSlice{} assert.Nil(t, ts.Codes()) }
func TestTableStoreSliceIDs(t *testing.T) { t.Skip(TODO_Better_Test_Data) ids := testStores.Extract().StoreID() assert.NotNil(t, ids) assert.Equal(t, utils.Int64Slice{0, 5, 1, 4, 2, 6, 3}, ids) var ts = store.TableStoreSlice{} assert.Nil(t, ts.Extract().StoreID()) }
func TestTableStoreSliceCodes(t *testing.T) { t.Skip(TODO_Better_Test_Data) codes := testStores.Extract().Code() assert.NotNil(t, codes) assert.Equal(t, utils.StringSlice{"admin", "au", "de", "uk", "at", "nz", "ch"}, codes) var ts = store.TableStoreSlice{} assert.Nil(t, ts.Extract().Code()) }
func TestTableStoreSliceFilterByWebsiteID(t *testing.T) { gStores := testStores.FilterByWebsiteID(0) assert.NotNil(t, gStores) assert.Len(t, gStores, 1) gStores2 := testStores.FilterByWebsiteID(32) assert.Nil(t, gStores2) assert.Len(t, gStores2, 0) var ts = store.TableStoreSlice{} assert.Nil(t, ts.FilterByGroupID(2)) }
func TestTableStoreSliceLoad(t *testing.T) { db := csdb.MustConnectTest() defer db.Close() dbrSess := dbr.NewConnection(db, nil).NewSession(nil) var stores store.TableStoreSlice stores.Load(dbrSess) assert.True(t, stores.Len() > 2) for _, s := range stores { assert.True(t, len(s.Code.String) > 1) } }
func TestTableStoreSliceLoad(t *testing.T) { dbc := csdb.MustConnectTest() defer dbc.Close() dbrSess := dbc.NewSession() var stores store.TableStoreSlice stores.SQLSelect(dbrSess) assert.True(t, stores.Len() >= 2) // @todo proper test data in database for _, s := range stores { assert.True(t, len(s.Code.String) > 1) } }
func TestTableStoreSliceLoad(t *testing.T) { defer debugLogBuf.Reset() dbc := csdb.MustConnectTest() defer func() { assert.NoError(t, dbc.Close()) }() dbrSess := dbc.NewSession() var stores store.TableStoreSlice _, err := stores.SQLSelect(dbrSess) assert.NoError(t, err) assert.True(t, stores.Len() >= 2) // @todo proper test data in database for _, s := range stores { assert.True(t, len(s.Code.String) > 1) } }