Extend API to allow CRUD labels

Add Labels API
    * List all labels for this repository
    * Get a single label
    * Create a label
    * Update a label
    * Delete a label

    Reject duplicated label name

    Add test case for LabelsService
This commit is contained in:
lidice
2016-01-22 07:44:35 +09:00
parent 95746de5aa
commit 64cacb18a4
10 changed files with 271 additions and 5 deletions

View File

@@ -209,6 +209,15 @@ class JsonFormatSpec extends Specification {
"url": "${context.baseUrl}/api/v3/repos/octocat/Hello-World/commits/$sha1/status"
}"""
val apiLabel = ApiLabel(
name = "bug",
color = "f29513")(RepositoryName("octocat","Hello-World"))
val apiLabelJson = s"""{
"name": "bug",
"color": "f29513",
"url": "${context.baseUrl}/api/v3/repos/octocat/Hello-World/labels/bug"
}"""
val apiIssue = ApiIssue(
number = 1347,
title = "Found a bug",
@@ -411,6 +420,9 @@ class JsonFormatSpec extends Specification {
"apiCombinedCommitStatus" in {
JsonFormat(apiCombinedCommitStatus) must beFormatted(apiCombinedCommitStatusJson)
}
"apiLabel" in {
JsonFormat(apiLabel) must beFormatted(apiLabelJson)
}
"apiIssue" in {
JsonFormat(apiIssue) must beFormatted(apiIssueJson)
JsonFormat(apiIssuePR) must beFormatted(apiIssuePRJson)