From 7a9e5112eaaea58d55f181d3e5296e4ff839921c Mon Sep 17 00:00:00 2001 From: jloup Date: Wed, 14 Feb 2018 14:19:09 +0100 Subject: initial commit --- db/db_test.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 db/db_test.go (limited to 'db/db_test.go') 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 @@ +package db + +import "testing" + +func TestInit(t *testing.T) { + Init(DBConfig{"localhost:5432", "cryptoportfolio", "cryptoportfolio", "cryptoportfolio-dev"}) +} + +func TestUpdateUser(t *testing.T) { + Init(DBConfig{"localhost:5432", "cryptoportfolio", "cryptoportfolio", "cryptoportfolio-dev"}) + t.Log(InsertUser(&User{Email: "j@test.com", PasswordHash: "yp"})) + err := InsertUser(&User{Email: "t2@test.com", PasswordHash: "yp"}) + + t.Log(err, IsDup(err)) + + t.Log(GetUserByEmail("testyo")) +} + +func TestMarketConfig(t *testing.T) { + Init(DBConfig{"localhost:5432", "cryptoportfolio", "cryptoportfolio", "cryptoportfolio-dev"}) + + config := MarketConfig{UserId: 1, MarketName: "poloniex"} + config.Config = make(map[string]string) + + config.Config["secret"] = "key" + + t.Log(InsertMarketConfig(&config)) + t.Log(config) + + t.Log(GetUserMarketConfig(1, "poloniex")) + + config.Config["secret2"] = "key2" + t.Log(SetUserMarketConfig(1, "poloniex", config.Config)) + t.Log(SetUserMarketConfig(1, "bifinance", config.Config)) +} -- cgit v1.2.3