]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front.git/blame - db/db_test.go
initial commit
[perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front.git] / db / db_test.go
CommitLineData
7a9e5112 1package db
2
3import "testing"
4
5func TestInit(t *testing.T) {
6 Init(DBConfig{"localhost:5432", "cryptoportfolio", "cryptoportfolio", "cryptoportfolio-dev"})
7}
8
9func 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"})
13
14 t.Log(err, IsDup(err))
15
16 t.Log(GetUserByEmail("testyo"))
17}
18
19func TestMarketConfig(t *testing.T) {
20 Init(DBConfig{"localhost:5432", "cryptoportfolio", "cryptoportfolio", "cryptoportfolio-dev"})
21
22 config := MarketConfig{UserId: 1, MarketName: "poloniex"}
23 config.Config = make(map[string]string)
24
25 config.Config["secret"] = "key"
26
27 t.Log(InsertMarketConfig(&config))
28 t.Log(config)
29
30 t.Log(GetUserMarketConfig(1, "poloniex"))
31
32 config.Config["secret2"] = "key2"
33 t.Log(SetUserMarketConfig(1, "poloniex", config.Config))
34 t.Log(SetUserMarketConfig(1, "bifinance", config.Config))
35}