aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Berwaldt <zberwaldt@tutamail.com>2024-03-15 21:45:01 -0400
committerZach Berwaldt <zberwaldt@tutamail.com>2024-03-15 21:45:01 -0400
commitcc49361bcbf689510035e7bbdcce9d8467a36282 (patch)
treeaa89ee1968e1b0966c6e0f7df92c3b48684f3c99
parentc4e5776f9e174fe6bf91721649c0541a9fb310ae (diff)
add newline, clean up test
-rw-r--r--api/cmd/main_test.go10
-rw-r--r--api/internal/config/config.go2
2 files changed, 3 insertions, 9 deletions
diff --git a/api/cmd/main_test.go b/api/cmd/main_test.go
index 049cf6e..a4db57a 100644
--- a/api/cmd/main_test.go
+++ b/api/cmd/main_test.go
@@ -8,15 +8,12 @@ import (
8 "testing" 8 "testing"
9 "water/api/internal/router" 9 "water/api/internal/router"
10 10
11 "github.com/spf13/viper"
12 "github.com/stretchr/testify/assert" 11 "github.com/stretchr/testify/assert"
12 "water/api/internal/config"
13) 13)
14 14
15func getTestUserCredentials() (string, string) { 15func getTestUserCredentials() (string, string) {
16 viper.SetConfigFile("../.env") 16 viper, err := config.Load()
17 viper.AddConfigPath(".")
18 viper.AutomaticEnv()
19 err := viper.ReadInConfig()
20 if err != nil { 17 if err != nil {
21 log.Fatalf("Error while reading config file %s", err) 18 log.Fatalf("Error while reading config file %s", err)
22 } 19 }
@@ -31,9 +28,6 @@ func TestAuthRoute(t *testing.T) {
31 28
32 username, password := getTestUserCredentials() 29 username, password := getTestUserCredentials()
33 30
34 log.Println("username", username)
35 log.Println("password", password)
36
37 w := httptest.NewRecorder() 31 w := httptest.NewRecorder()
38 req, err := http.NewRequest("POST", "/api/v1/auth", nil) 32 req, err := http.NewRequest("POST", "/api/v1/auth", nil)
39 if err != nil { 33 if err != nil {
diff --git a/api/internal/config/config.go b/api/internal/config/config.go
index 1892696..d54e40e 100644
--- a/api/internal/config/config.go
+++ b/api/internal/config/config.go
@@ -14,4 +14,4 @@ func Load() (*viper.Viper, error) {
14 return nil, fmt.Errorf("error reading .env file: %s", err) 14 return nil, fmt.Errorf("error reading .env file: %s", err)
15 } 15 }
16 return v, nil 16 return v, nil
17} \ No newline at end of file 17}