Update test
This commit is contained in:
parent
bb4052d1d2
commit
8e85d0ddbd
|
@ -1,6 +1,7 @@
|
||||||
package test
|
package test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/authorizerdev/authorizer/server/constants"
|
"github.com/authorizerdev/authorizer/server/constants"
|
||||||
|
@ -20,11 +21,19 @@ func TestResolvers(t *testing.T) {
|
||||||
constants.EnvData.DATABASE_URL = dbURL
|
constants.EnvData.DATABASE_URL = dbURL
|
||||||
constants.EnvData.DATABASE_TYPE = dbType
|
constants.EnvData.DATABASE_TYPE = dbType
|
||||||
db.InitDB()
|
db.InitDB()
|
||||||
|
|
||||||
|
// clean the persisted config for test to use fresh config
|
||||||
|
config, err := db.Mgr.GetConfig()
|
||||||
|
if err == nil {
|
||||||
|
config.Config = []byte{}
|
||||||
|
db.Mgr.UpdateConfig(config)
|
||||||
|
}
|
||||||
env.PersistEnv()
|
env.PersistEnv()
|
||||||
|
|
||||||
s := testSetup()
|
s := testSetup()
|
||||||
defer s.Server.Close()
|
defer s.Server.Close()
|
||||||
|
|
||||||
|
log.Println("EnvData:", constants.EnvData)
|
||||||
t.Run("should pass tests for "+dbType, func(t *testing.T) {
|
t.Run("should pass tests for "+dbType, func(t *testing.T) {
|
||||||
loginTests(s, t)
|
loginTests(s, t)
|
||||||
signupTests(s, t)
|
signupTests(s, t)
|
||||||
|
|
|
@ -17,7 +17,7 @@ func SendMail(to []string, Subject, bodyMessage string) error {
|
||||||
m.SetBody("text/html", bodyMessage)
|
m.SetBody("text/html", bodyMessage)
|
||||||
port, _ := strconv.Atoi(constants.EnvData.SMTP_PORT)
|
port, _ := strconv.Atoi(constants.EnvData.SMTP_PORT)
|
||||||
d := gomail.NewDialer(constants.EnvData.SMTP_HOST, port, constants.EnvData.SMTP_USERNAME, constants.EnvData.SMTP_PASSWORD)
|
d := gomail.NewDialer(constants.EnvData.SMTP_HOST, port, constants.EnvData.SMTP_USERNAME, constants.EnvData.SMTP_PASSWORD)
|
||||||
if constants.ENV == "development" {
|
if constants.EnvData.ENV == "development" {
|
||||||
d.TLSConfig = &tls.Config{InsecureSkipVerify: true}
|
d.TLSConfig = &tls.Config{InsecureSkipVerify: true}
|
||||||
}
|
}
|
||||||
if err := d.DialAndSend(m); err != nil {
|
if err := d.DialAndSend(m); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user