mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-08 06:25:51 +01:00
(refs #1271)Fix testcase
This commit is contained in:
@@ -48,15 +48,11 @@ object ApiPullRequest{
|
|||||||
head = Commit(
|
head = Commit(
|
||||||
sha = pullRequest.commitIdTo,
|
sha = pullRequest.commitIdTo,
|
||||||
ref = pullRequest.requestBranch,
|
ref = pullRequest.requestBranch,
|
||||||
repo = headRepo,
|
repo = headRepo)(issue.userName),
|
||||||
baseOwner = issue.userName
|
|
||||||
),
|
|
||||||
base = Commit(
|
base = Commit(
|
||||||
sha = pullRequest.commitIdFrom,
|
sha = pullRequest.commitIdFrom,
|
||||||
ref = pullRequest.branch,
|
ref = pullRequest.branch,
|
||||||
repo = baseRepo,
|
repo = baseRepo)(issue.userName),
|
||||||
baseOwner = issue.userName
|
|
||||||
),
|
|
||||||
mergeable = None, // TODO: need check mergeable.
|
mergeable = None, // TODO: need check mergeable.
|
||||||
merged = mergedComment.isDefined,
|
merged = mergedComment.isDefined,
|
||||||
merged_at = mergedComment.map { case (comment, _) => comment.registeredDate },
|
merged_at = mergedComment.map { case (comment, _) => comment.registeredDate },
|
||||||
@@ -69,8 +65,7 @@ object ApiPullRequest{
|
|||||||
case class Commit(
|
case class Commit(
|
||||||
sha: String,
|
sha: String,
|
||||||
ref: String,
|
ref: String,
|
||||||
repo: ApiRepository,
|
repo: ApiRepository)(baseOwner:String){
|
||||||
baseOwner:String){
|
|
||||||
val label = if( baseOwner == repo.owner.login ){ ref }else{ s"${repo.owner.login}:${ref}" }
|
val label = if( baseOwner == repo.owner.login ){ ref }else{ s"${repo.owner.login}:${ref}" }
|
||||||
val user = repo.owner
|
val user = repo.owner
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ class JsonFormatSpec extends FunSuite {
|
|||||||
implicit val context = JsonFormat.Context("http://gitbucket.exmple.com")
|
implicit val context = JsonFormat.Context("http://gitbucket.exmple.com")
|
||||||
|
|
||||||
val apiUser = ApiUser(
|
val apiUser = ApiUser(
|
||||||
login= "octocat",
|
login = "octocat",
|
||||||
email= "octocat@example.com",
|
email = "octocat@example.com",
|
||||||
`type`= "User",
|
`type` = "User",
|
||||||
site_admin= false,
|
site_admin = false,
|
||||||
created_at= date1)
|
created_at = date1)
|
||||||
val apiUserJson = """{
|
val apiUserJson = """{
|
||||||
"login":"octocat",
|
"login":"octocat",
|
||||||
"email":"octocat@example.com",
|
"email":"octocat@example.com",
|
||||||
@@ -276,48 +276,52 @@ class JsonFormatSpec extends FunSuite {
|
|||||||
ref = "master",
|
ref = "master",
|
||||||
repo = repository)("octocat"),
|
repo = repository)("octocat"),
|
||||||
mergeable = None,
|
mergeable = None,
|
||||||
|
merged = false,
|
||||||
|
merged_at = Some(date1),
|
||||||
|
merged_by = Some(apiUser),
|
||||||
title = "new-feature",
|
title = "new-feature",
|
||||||
body = "Please pull these awesome changes",
|
body = "Please pull these awesome changes",
|
||||||
user = apiUser
|
user = apiUser
|
||||||
)
|
)
|
||||||
|
|
||||||
val apiPullRequestJson = s"""{
|
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",
|
"html_url": "${context.baseUrl}/octocat/Hello-World/pull/1347",
|
||||||
// "diff_url": "${context.baseUrl}/octocat/Hello-World/pull/1347.diff",
|
"url": "${context.baseUrl}/api/v3/repos/octocat/Hello-World/pulls/1347",
|
||||||
// "patch_url": "${context.baseUrl}/octocat/Hello-World/pull/1347.patch",
|
|
||||||
// "issue_url": "${context.baseUrl}/api/v3/repos/octocat/Hello-World/issues/1347",
|
|
||||||
"commits_url": "${context.baseUrl}/api/v3/repos/octocat/Hello-World/pulls/1347/commits",
|
"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_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}",
|
"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",
|
"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",
|
"statuses_url": "${context.baseUrl}/api/v3/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e"
|
||||||
"number": 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",
|
||||||
// "state": "open",
|
// "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,
|
// "comments": 10,
|
||||||
// "commits": 3,
|
// "commits": 3,
|
||||||
// "additions": 100,
|
// "additions": 100,
|
||||||
|
|||||||
Reference in New Issue
Block a user