5 func TestInit(t *testing.T) {
6 Init(DBConfig{"localhost:5432", "cryptoportfolio", "cryptoportfolio", "cryptoportfolio-dev"})
9 func TestUpdateUser(t *testing.T) {
10 Init(DBConfig{"localhost:5432", "cryptoportfolio", "cryptoportfolio", "cryptoportfolio-dev"})
11 t.Log(InsertUser(&User{Email: "j@test.com", PasswordHash: "yp"}))
12 err := InsertUser(&User{Email: "t2@test.com", PasswordHash: "yp"})
14 t.Log(err, IsDup(err))
16 t.Log(GetUserByEmail("testyo"))
19 func TestMarketConfig(t *testing.T) {
20 Init(DBConfig{"localhost:5432", "cryptoportfolio", "cryptoportfolio", "cryptoportfolio-dev"})
22 config := MarketConfig{UserId: 1, MarketName: "poloniex"}
23 config.Config = make(map[string]string)
25 config.Config["secret"] = "key"
27 t.Log(InsertMarketConfig(&config))
30 t.Log(GetUserMarketConfig(1, "poloniex"))
32 config.Config["secret2"] = "key2"
33 t.Log(SetUserMarketConfig(1, "poloniex", config.Config))
34 t.Log(SetUserMarketConfig(1, "bifinance", config.Config))