diff options
author | jloup <jean-loup.jamet@trainline.com> | 2018-02-14 14:19:09 +0100 |
---|---|---|
committer | jloup <jean-loup.jamet@trainline.com> | 2018-02-14 14:19:09 +0100 |
commit | 7a9e5112eaaea58d55f181d3e5296e4ff839921c (patch) | |
tree | 968ed193f42a1fad759cc89ad2f8ad5b0091291e /db/db_test.go | |
download | Front-7a9e5112eaaea58d55f181d3e5296e4ff839921c.tar.gz Front-7a9e5112eaaea58d55f181d3e5296e4ff839921c.tar.zst Front-7a9e5112eaaea58d55f181d3e5296e4ff839921c.zip |
initial commit
Diffstat (limited to 'db/db_test.go')
-rw-r--r-- | db/db_test.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/db/db_test.go b/db/db_test.go new file mode 100644 index 0000000..0481915 --- /dev/null +++ b/db/db_test.go | |||
@@ -0,0 +1,35 @@ | |||
1 | package db | ||
2 | |||
3 | import "testing" | ||
4 | |||
5 | func TestInit(t *testing.T) { | ||
6 | Init(DBConfig{"localhost:5432", "cryptoportfolio", "cryptoportfolio", "cryptoportfolio-dev"}) | ||
7 | } | ||
8 | |||
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"}) | ||
13 | |||
14 | t.Log(err, IsDup(err)) | ||
15 | |||
16 | t.Log(GetUserByEmail("testyo")) | ||
17 | } | ||
18 | |||
19 | func 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 | } | ||