2
0
Alexander Belanger 5 жил өмнө
parent
commit
e88b26eb9a

+ 1 - 0
.gitignore

@@ -1,5 +1,6 @@
 .DS_Store
 .DS_Store
 .env
 .env
+docker/.env
 app
 app
 *.db
 *.db
 test.yaml
 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{
 	return &App{
 		logger:       logger,
 		logger:       logger,
 		repo:         repo,
 		repo:         repo,
@@ -73,7 +79,7 @@ func New(
 		cookieName:   cookieName,
 		cookieName:   cookieName,
 		testing:      testing,
 		testing:      testing,
 		TestAgents:   testAgents,
 		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"
 			"name": "project-test"
 		}`,
 		}`,
 		expStatus: http.StatusCreated,
 		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,
 		useCookie: true,
 		validators: []func(c *projTest, tester *tester, t *testing.T){
 		validators: []func(c *projTest, tester *tester, t *testing.T){
 			projectModelBodyValidator,
 			projectModelBodyValidator,
@@ -104,7 +104,7 @@ var readProjectTests = []*projTest{
 		endpoint:  "/api/projects/1",
 		endpoint:  "/api/projects/1",
 		body:      ``,
 		body:      ``,
 		expStatus: http.StatusOK,
 		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,
 		useCookie: true,
 		validators: []func(c *projTest, tester *tester, t *testing.T){
 		validators: []func(c *projTest, tester *tester, t *testing.T){
 			projectModelBodyValidator,
 			projectModelBodyValidator,