mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 22:15:51 +01:00
Merge branch 'master'
Conflicts: build.sbt src/main/scala/gitbucket/core/service/CommitsService.scala src/main/scala/gitbucket/core/service/PullRequestService.scala src/main/scala/gitbucket/core/service/RepositoryService.scala src/main/scala/gitbucket/core/service/WebHookService.scala
This commit is contained in:
@@ -25,11 +25,11 @@ class JsonFormatSpec extends FunSuite {
|
||||
implicit val context = JsonFormat.Context("http://gitbucket.exmple.com")
|
||||
|
||||
val apiUser = ApiUser(
|
||||
login= "octocat",
|
||||
email= "octocat@example.com",
|
||||
`type`= "User",
|
||||
site_admin= false,
|
||||
created_at= date1)
|
||||
login = "octocat",
|
||||
email = "octocat@example.com",
|
||||
`type` = "User",
|
||||
site_admin = false,
|
||||
created_at = date1)
|
||||
val apiUserJson = """{
|
||||
"login":"octocat",
|
||||
"email":"octocat@example.com",
|
||||
@@ -264,60 +264,64 @@ class JsonFormatSpec extends FunSuite {
|
||||
}"""
|
||||
|
||||
val apiPullRequest = ApiPullRequest(
|
||||
number = 1347,
|
||||
updated_at = date1,
|
||||
created_at = date1,
|
||||
head = ApiPullRequest.Commit(
|
||||
sha = sha1,
|
||||
ref = "new-topic",
|
||||
repo = repository)("octocat"),
|
||||
base = ApiPullRequest.Commit(
|
||||
sha = sha1,
|
||||
ref = "master",
|
||||
repo = repository)("octocat"),
|
||||
mergeable = None,
|
||||
title = "new-feature",
|
||||
body = "Please pull these awesome changes",
|
||||
user = apiUser
|
||||
)
|
||||
number = 1347,
|
||||
updated_at = date1,
|
||||
created_at = date1,
|
||||
head = ApiPullRequest.Commit(
|
||||
sha = sha1,
|
||||
ref = "new-topic",
|
||||
repo = repository)("octocat"),
|
||||
base = ApiPullRequest.Commit(
|
||||
sha = sha1,
|
||||
ref = "master",
|
||||
repo = repository)("octocat"),
|
||||
mergeable = None,
|
||||
merged = false,
|
||||
merged_at = Some(date1),
|
||||
merged_by = Some(apiUser),
|
||||
title = "new-feature",
|
||||
body = "Please pull these awesome changes",
|
||||
user = apiUser
|
||||
)
|
||||
|
||||
val apiPullRequestJson = s"""{
|
||||
"url": "${context.baseUrl}/api/v3/repos/octocat/Hello-World/pulls/1347",
|
||||
"number": 1347,
|
||||
"updated_at": "2011-04-14T16:00:49Z",
|
||||
"created_at": "2011-04-14T16:00:49Z",
|
||||
// "closed_at": "2011-04-14T16:00:49Z",
|
||||
"head": {
|
||||
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||
"ref": "new-topic",
|
||||
"repo": $repositoryJson,
|
||||
"label": "new-topic",
|
||||
"user": $apiUserJson
|
||||
},
|
||||
"base": {
|
||||
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||
"ref": "master",
|
||||
"repo": $repositoryJson,
|
||||
"label": "master",
|
||||
"user": $apiUserJson
|
||||
},
|
||||
// "merge_commit_sha": "e5bd3914e2e596debea16f433f57875b5b90bcd6",
|
||||
// "mergeable": true,
|
||||
"merged": false,
|
||||
"merged_at": "2011-04-14T16:00:49Z",
|
||||
"merged_by": $apiUserJson,
|
||||
"title": "new-feature",
|
||||
"body": "Please pull these awesome changes",
|
||||
"user": $apiUserJson,
|
||||
"html_url": "${context.baseUrl}/octocat/Hello-World/pull/1347",
|
||||
// "diff_url": "${context.baseUrl}/octocat/Hello-World/pull/1347.diff",
|
||||
// "patch_url": "${context.baseUrl}/octocat/Hello-World/pull/1347.patch",
|
||||
// "issue_url": "${context.baseUrl}/api/v3/repos/octocat/Hello-World/issues/1347",
|
||||
"url": "${context.baseUrl}/api/v3/repos/octocat/Hello-World/pulls/1347",
|
||||
"commits_url": "${context.baseUrl}/api/v3/repos/octocat/Hello-World/pulls/1347/commits",
|
||||
"review_comments_url": "${context.baseUrl}/api/v3/repos/octocat/Hello-World/pulls/1347/comments",
|
||||
"review_comment_url": "${context.baseUrl}/api/v3/repos/octocat/Hello-World/pulls/comments/{number}",
|
||||
"comments_url": "${context.baseUrl}/api/v3/repos/octocat/Hello-World/issues/1347/comments",
|
||||
"statuses_url": "${context.baseUrl}/api/v3/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||
"number": 1347,
|
||||
"statuses_url": "${context.baseUrl}/api/v3/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e"
|
||||
// "diff_url": "${context.baseUrl}/octocat/Hello-World/pull/1347.diff",
|
||||
// "patch_url": "${context.baseUrl}/octocat/Hello-World/pull/1347.patch",
|
||||
// "issue_url": "${context.baseUrl}/api/v3/repos/octocat/Hello-World/issues/1347",
|
||||
// "state": "open",
|
||||
"title": "new-feature",
|
||||
"body": "Please pull these awesome changes",
|
||||
"created_at": "2011-04-14T16:00:49Z",
|
||||
"updated_at": "2011-04-14T16:00:49Z",
|
||||
// "closed_at": "2011-04-14T16:00:49Z",
|
||||
// "merged_at": "2011-04-14T16:00:49Z",
|
||||
"head": {
|
||||
"label": "new-topic",
|
||||
"ref": "new-topic",
|
||||
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||
"user": $apiUserJson,
|
||||
"repo": $repositoryJson
|
||||
},
|
||||
"base": {
|
||||
"label": "master",
|
||||
"ref": "master",
|
||||
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||
"user": $apiUserJson,
|
||||
"repo": $repositoryJson
|
||||
},
|
||||
"user": $apiUserJson
|
||||
// "merge_commit_sha": "e5bd3914e2e596debea16f433f57875b5b90bcd6",
|
||||
// "merged": false,
|
||||
// "mergeable": true,
|
||||
// "merged_by": $$apiUserJson,
|
||||
// "comments": 10,
|
||||
// "commits": 3,
|
||||
// "additions": 100,
|
||||
|
||||
@@ -4,7 +4,7 @@ import gitbucket.core.model._
|
||||
import org.scalatest.FunSpec
|
||||
|
||||
class PullRequestServiceSpec extends FunSpec with ServiceSpecBase
|
||||
with PullRequestService with IssuesService with AccountService with RepositoryService {
|
||||
with PullRequestService with IssuesService with AccountService with RepositoryService with CommitsService {
|
||||
|
||||
def swap(r: (Issue, PullRequest)) = (r._2 -> r._1)
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ trait ServiceSpecBase {
|
||||
def user(name:String)(implicit s:Session):Account = AccountService.getAccountByUserName(name).get
|
||||
|
||||
lazy val dummyService = new RepositoryService with AccountService with IssuesService with PullRequestService
|
||||
with CommitStatusService with LabelsService (){}
|
||||
with CommitsService with CommitStatusService with LabelsService (){}
|
||||
|
||||
def generateNewUserWithDBRepository(userName:String, repositoryName:String)(implicit s:Session):Account = {
|
||||
val ac = AccountService.getAccountByUserName(userName).getOrElse(generateNewAccount(userName))
|
||||
|
||||
@@ -6,7 +6,7 @@ import gitbucket.core.model.WebHookContentType
|
||||
|
||||
|
||||
class WebHookServiceSpec extends FunSuite with ServiceSpecBase {
|
||||
lazy val service = new WebHookPullRequestService with AccountService with RepositoryService with PullRequestService with IssuesService
|
||||
lazy val service = new WebHookPullRequestService with AccountService with RepositoryService with PullRequestService with IssuesService with CommitsService
|
||||
|
||||
test("WebHookPullRequestService.getPullRequestsByRequestForWebhook") { withTestDB { implicit session =>
|
||||
val user1 = generateNewUserWithDBRepository("user1","repo1")
|
||||
|
||||
@@ -3,10 +3,11 @@ package gitbucket.core.view
|
||||
import java.util.Date
|
||||
|
||||
import gitbucket.core.model.Account
|
||||
import gitbucket.core.service.{SystemSettingsService, RequestCache}
|
||||
import gitbucket.core.service.{RequestCache, SystemSettingsService}
|
||||
import gitbucket.core.controller.Context
|
||||
import SystemSettingsService.SystemSettings
|
||||
import javax.servlet.http.HttpServletRequest
|
||||
import javax.servlet.http.{HttpServletRequest, HttpSession}
|
||||
|
||||
import play.twirl.api.Html
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatest.mock.MockitoSugar
|
||||
@@ -16,9 +17,11 @@ import org.mockito.Mockito._
|
||||
class AvatarImageProviderSpec extends FunSpec with MockitoSugar {
|
||||
|
||||
val request = mock[HttpServletRequest]
|
||||
val session = mock[HttpSession]
|
||||
when(request.getRequestURL).thenReturn(new StringBuffer("http://localhost:8080/path.html"))
|
||||
when(request.getRequestURI).thenReturn("/path.html")
|
||||
when(request.getContextPath).thenReturn("")
|
||||
when(request.getSession).thenReturn(session)
|
||||
|
||||
describe("getAvatarImageHtml") {
|
||||
it("should show Gravatar image for no image account if gravatar integration is enabled") {
|
||||
|
||||
Reference in New Issue
Block a user