mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 22:15:51 +01:00
Fix test.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package gitbucket.core.service
|
||||
|
||||
import gitbucket.core.model.WebHook
|
||||
import gitbucket.core.model.{WebHook, RepositoryWebHook}
|
||||
import org.scalatest.FunSuite
|
||||
import gitbucket.core.model.WebHookContentType
|
||||
|
||||
@@ -47,17 +47,17 @@ class WebHookServiceSpec extends FunSuite with ServiceSpecBase {
|
||||
val formType = WebHookContentType.FORM
|
||||
val jsonType = WebHookContentType.JSON
|
||||
service.addWebHook("user1", "repo1", "http://example.com", Set(WebHook.PullRequest), formType, Some("key"))
|
||||
assert(service.getWebHooks("user1", "repo1") == List((WebHook("user1","repo1","http://example.com", formType, Some("key")),Set(WebHook.PullRequest))))
|
||||
assert(service.getWebHook("user1", "repo1", "http://example.com") == Some((WebHook("user1","repo1","http://example.com", formType, Some("key")),Set(WebHook.PullRequest))))
|
||||
assert(service.getWebHooksByEvent("user1", "repo1", WebHook.PullRequest) == List((WebHook("user1","repo1","http://example.com", formType, Some("key")))))
|
||||
assert(service.getWebHooks("user1", "repo1") == List((RepositoryWebHook("user1","repo1","http://example.com", formType, Some("key")),Set(WebHook.PullRequest))))
|
||||
assert(service.getWebHook("user1", "repo1", "http://example.com") == Some((RepositoryWebHook("user1","repo1","http://example.com", formType, Some("key")),Set(WebHook.PullRequest))))
|
||||
assert(service.getWebHooksByEvent("user1", "repo1", WebHook.PullRequest) == List((RepositoryWebHook("user1","repo1","http://example.com", formType, Some("key")))))
|
||||
assert(service.getWebHooksByEvent("user1", "repo1", WebHook.Push) == Nil)
|
||||
assert(service.getWebHook("user1", "repo1", "http://example.com2") == None)
|
||||
assert(service.getWebHook("user2", "repo1", "http://example.com") == None)
|
||||
assert(service.getWebHook("user1", "repo2", "http://example.com") == None)
|
||||
service.updateWebHook("user1", "repo1", "http://example.com", Set(WebHook.Push, WebHook.Issues), jsonType, Some("key"))
|
||||
assert(service.getWebHook("user1", "repo1", "http://example.com") == Some((WebHook("user1","repo1","http://example.com", jsonType, Some("key")),Set(WebHook.Push, WebHook.Issues))))
|
||||
assert(service.getWebHook("user1", "repo1", "http://example.com") == Some((RepositoryWebHook("user1","repo1","http://example.com", jsonType, Some("key")),Set(WebHook.Push, WebHook.Issues))))
|
||||
assert(service.getWebHooksByEvent("user1", "repo1", WebHook.PullRequest) == Nil)
|
||||
assert(service.getWebHooksByEvent("user1", "repo1", WebHook.Push) == List((WebHook("user1","repo1","http://example.com", jsonType, Some("key")))))
|
||||
assert(service.getWebHooksByEvent("user1", "repo1", WebHook.Push) == List((RepositoryWebHook("user1","repo1","http://example.com", jsonType, Some("key")))))
|
||||
service.deleteWebHook("user1", "repo1", "http://example.com")
|
||||
assert(service.getWebHook("user1", "repo1", "http://example.com") == None)
|
||||
} }
|
||||
@@ -69,11 +69,11 @@ class WebHookServiceSpec extends FunSuite with ServiceSpecBase {
|
||||
service.addWebHook("user1", "repo1", "http://example.com/2", Set(WebHook.Push), ctype, Some("key"))
|
||||
service.addWebHook("user1", "repo1", "http://example.com/3", Set(WebHook.PullRequest,WebHook.Push), ctype, Some("key"))
|
||||
assert(service.getWebHooks("user1", "repo1") == List(
|
||||
WebHook("user1","repo1","http://example.com/1", ctype, Some("key"))->Set(WebHook.PullRequest),
|
||||
WebHook("user1","repo1","http://example.com/2", ctype, Some("key"))->Set(WebHook.Push),
|
||||
WebHook("user1","repo1","http://example.com/3", ctype, Some("key"))->Set(WebHook.PullRequest,WebHook.Push)))
|
||||
RepositoryWebHook("user1","repo1","http://example.com/1", ctype, Some("key"))->Set(WebHook.PullRequest),
|
||||
RepositoryWebHook("user1","repo1","http://example.com/2", ctype, Some("key"))->Set(WebHook.Push),
|
||||
RepositoryWebHook("user1","repo1","http://example.com/3", ctype, Some("key"))->Set(WebHook.PullRequest,WebHook.Push)))
|
||||
assert(service.getWebHooksByEvent("user1", "repo1", WebHook.PullRequest) == List(
|
||||
WebHook("user1","repo1","http://example.com/1", ctype, Some("key")),
|
||||
WebHook("user1","repo1","http://example.com/3", ctype, Some("key"))))
|
||||
RepositoryWebHook("user1","repo1","http://example.com/1", ctype, Some("key")),
|
||||
RepositoryWebHook("user1","repo1","http://example.com/3", ctype, Some("key"))))
|
||||
} }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user