Jelajahi Sumber

fixed tests

Alexander Belanger 5 tahun lalu
induk
melakukan
e88b26eb9a
3 mengubah file dengan 10 tambahan dan 3 penghapusan
  1. 1 0
      .gitignore
  2. 7 1
      server/api/api.go
  3. 2 2
      server/api/project_handler_test.go

+ 1 - 0
.gitignore

@@ -1,5 +1,6 @@
 .DS_Store
 .env
+docker/.env
 app
 *.db
 test.yaml

+ 7 - 1
server/api/api.go

@@ -64,6 +64,12 @@ func New(
 		}
 	}
 
+	var oauthGithubConf *oauth2.Config
+
+	if githubConfig != nil {
+		oauth.NewGithubClient(githubConfig)
+	}
+
 	return &App{
 		logger:       logger,
 		repo:         repo,
@@ -73,7 +79,7 @@ func New(
 		cookieName:   cookieName,
 		testing:      testing,
 		TestAgents:   testAgents,
-		GithubConfig: oauth.NewGithubClient(githubConfig),
+		GithubConfig: oauthGithubConf,
 	}
 }
 

+ 2 - 2
server/api/project_handler_test.go

@@ -81,7 +81,7 @@ var createProjectTests = []*projTest{
 			"name": "project-test"
 		}`,
 		expStatus: http.StatusCreated,
-		expBody:   `{"id":1,"name":"project-test","roles":[{"id":0,"kind":"admin","user_id":1,"project_id":1}]}`,
+		expBody:   `{"id":1,"name":"project-test","roles":[{"id":0,"kind":"admin","user_id":1,"project_id":1}],"repo_clients":[]}`,
 		useCookie: true,
 		validators: []func(c *projTest, tester *tester, t *testing.T){
 			projectModelBodyValidator,
@@ -104,7 +104,7 @@ var readProjectTests = []*projTest{
 		endpoint:  "/api/projects/1",
 		body:      ``,
 		expStatus: http.StatusOK,
-		expBody:   `{"id":1,"name":"project-test","roles":[{"id":0,"kind":"admin","user_id":1,"project_id":1}]}`,
+		expBody:   `{"id":1,"name":"project-test","roles":[{"id":0,"kind":"admin","user_id":1,"project_id":1}],"repo_clients":[]}`,
 		useCookie: true,
 		validators: []func(c *projTest, tester *tester, t *testing.T){
 			projectModelBodyValidator,