mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 05:55:51 +01:00
Bump Scalatra to 2.7.0-GA (#2494)
This commit is contained in:
@@ -7,11 +7,12 @@ import io.github.gitbucket.solidbase.Solidbase
|
||||
import io.github.gitbucket.solidbase.model.Module
|
||||
import liquibase.database.core.{H2Database, MySQLDatabase, PostgresDatabase}
|
||||
import org.junit.runner.Description
|
||||
import org.scalatest.{FunSuite, Tag}
|
||||
import org.scalatest.funsuite.AnyFunSuite
|
||||
import org.scalatest.Tag
|
||||
|
||||
object ExternalDBTest extends Tag("ExternalDBTest")
|
||||
|
||||
class GitBucketCoreModuleSpec extends FunSuite {
|
||||
class GitBucketCoreModuleSpec extends AnyFunSuite {
|
||||
|
||||
test("Migration H2") {
|
||||
new Solidbase().migrate(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package gitbucket.core.api
|
||||
|
||||
import org.scalatest.FunSuite
|
||||
import org.scalatest.funsuite.AnyFunSuite
|
||||
|
||||
class JsonFormatSpec extends FunSuite {
|
||||
class JsonFormatSpec extends AnyFunSuite {
|
||||
import ApiSpecModels._
|
||||
|
||||
private def expected(json: String) = json.replaceAll("\n", "")
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package gitbucket.core.model
|
||||
|
||||
import gitbucket.core.model.CommitState._
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatest.funspec.AnyFunSpec
|
||||
|
||||
class CommitStateSpec extends FunSpec {
|
||||
class CommitStateSpec extends AnyFunSpec {
|
||||
describe("CommitState") {
|
||||
it("should combine empty must eq PENDING") {
|
||||
assert(combine(Set()) == PENDING)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package gitbucket.core.service
|
||||
|
||||
import gitbucket.core.model._
|
||||
import org.scalatest.FunSuite
|
||||
import org.scalatest.funsuite.AnyFunSuite
|
||||
import gitbucket.core.model.Profile._
|
||||
import gitbucket.core.model.Profile.profile.blockingApi._
|
||||
|
||||
class AccessTokenServiceSpec extends FunSuite with ServiceSpecBase {
|
||||
class AccessTokenServiceSpec extends AnyFunSuite with ServiceSpecBase {
|
||||
|
||||
test("generateAccessToken") {
|
||||
withTestDB { implicit session =>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package gitbucket.core.service
|
||||
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatest.funspec.AnyFunSpec
|
||||
|
||||
class AccountFederationServiceSpec extends FunSpec with ServiceSpecBase {
|
||||
class AccountFederationServiceSpec extends AnyFunSpec with ServiceSpecBase {
|
||||
|
||||
describe("getOrCreateFederatedUser") {
|
||||
it("should create a federated account if it does not exist") {
|
||||
|
||||
@@ -2,9 +2,9 @@ package gitbucket.core.service
|
||||
|
||||
import gitbucket.core.model.{Account, GroupMember}
|
||||
import java.util.Date
|
||||
import org.scalatest.FunSuite
|
||||
import org.scalatest.funsuite.AnyFunSuite
|
||||
|
||||
class AccountServiceSpec extends FunSuite with ServiceSpecBase {
|
||||
class AccountServiceSpec extends AnyFunSuite with ServiceSpecBase {
|
||||
|
||||
val RootMailAddress = "root@localhost"
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@ import gitbucket.core.model._
|
||||
import gitbucket.core.model.Profile._
|
||||
import gitbucket.core.model.Profile.profile._
|
||||
import gitbucket.core.model.Profile.profile.blockingApi._
|
||||
import org.scalatest.FunSuite
|
||||
import org.scalatest.funsuite.AnyFunSuite
|
||||
|
||||
class CommitStatusServiceSpec
|
||||
extends FunSuite
|
||||
extends AnyFunSuite
|
||||
with ServiceSpecBase
|
||||
with CommitStatusService
|
||||
with RepositoryService
|
||||
|
||||
@@ -2,9 +2,9 @@ package gitbucket.core.service
|
||||
|
||||
import gitbucket.core.model._
|
||||
import gitbucket.core.service.IssuesService._
|
||||
import org.scalatest.FunSuite
|
||||
import org.scalatest.funsuite.AnyFunSuite
|
||||
|
||||
class IssuesServiceSpec extends FunSuite with ServiceSpecBase {
|
||||
class IssuesServiceSpec extends AnyFunSuite with ServiceSpecBase {
|
||||
test("getCommitStatues") {
|
||||
withTestDB { implicit session =>
|
||||
val user1 = generateNewUserWithDBRepository("user1", "repo1")
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package gitbucket.core.service
|
||||
|
||||
import gitbucket.core.model._
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatest.funspec.AnyFunSpec
|
||||
|
||||
class LabelsServiceSpec extends FunSpec with ServiceSpecBase {
|
||||
class LabelsServiceSpec extends AnyFunSpec with ServiceSpecBase {
|
||||
describe("getLabels") {
|
||||
it("should be empty when not have any labels") {
|
||||
withTestDB { implicit session =>
|
||||
|
||||
@@ -6,12 +6,12 @@ import gitbucket.core.util.GitSpecUtil._
|
||||
import org.eclipse.jgit.api.Git
|
||||
import org.eclipse.jgit.lib._
|
||||
import org.eclipse.jgit.revwalk._
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatest.funspec.AnyFunSpec
|
||||
|
||||
import java.io.File
|
||||
import scala.util.Using
|
||||
|
||||
class MergeServiceSpec extends FunSpec {
|
||||
class MergeServiceSpec extends AnyFunSpec {
|
||||
val service = new MergeService with AccountService with ActivityService with IssuesService with LabelsService
|
||||
with MilestonesService with RepositoryService with PrioritiesService with PullRequestService with CommitsService
|
||||
with WebHookPullRequestService with WebHookPullRequestReviewCommentService with RequestCache {}
|
||||
|
||||
@@ -5,10 +5,10 @@ import org.eclipse.jgit.transport.{ReceivePack, ReceiveCommand}
|
||||
import org.eclipse.jgit.lib.ObjectId
|
||||
import gitbucket.core.model.CommitState
|
||||
import gitbucket.core.service.ProtectedBranchService.{ProtectedBranchReceiveHook, ProtectedBranchInfo}
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatest.funspec.AnyFunSpec
|
||||
|
||||
class ProtectedBranchServiceSpec
|
||||
extends FunSpec
|
||||
extends AnyFunSpec
|
||||
with ServiceSpecBase
|
||||
with ProtectedBranchService
|
||||
with CommitStatusService {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package gitbucket.core.service
|
||||
|
||||
import gitbucket.core.model._
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatest.funspec.AnyFunSpec
|
||||
|
||||
class PullRequestServiceSpec
|
||||
extends FunSpec
|
||||
extends AnyFunSpec
|
||||
with ServiceSpecBase
|
||||
with MergeService
|
||||
with PullRequestService
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package gitbucket.core.service
|
||||
|
||||
import gitbucket.core.model._
|
||||
import org.scalatest.FunSuite
|
||||
import org.scalatest.funsuite.AnyFunSuite
|
||||
|
||||
class RepositoryServiceSpec extends FunSuite with ServiceSpecBase with RepositoryService with AccountService {
|
||||
class RepositoryServiceSpec extends AnyFunSuite with ServiceSpecBase with RepositoryService with AccountService {
|
||||
test("renameRepository can rename CommitState, ProtectedBranches") {
|
||||
withTestDB { implicit session =>
|
||||
val tester = generateNewAccount("tester")
|
||||
|
||||
@@ -14,16 +14,15 @@ import java.io.File
|
||||
import gitbucket.core.controller.Context
|
||||
import gitbucket.core.service.SystemSettingsService.{RepositoryOperation, Ssh, SystemSettings}
|
||||
import javax.servlet.http.{HttpServletRequest, HttpSession}
|
||||
import org.scalatestplus.mockito.MockitoSugar
|
||||
import org.mockito.Mockito._
|
||||
|
||||
import scala.util.Random
|
||||
import scala.util.Using
|
||||
|
||||
trait ServiceSpecBase extends MockitoSugar {
|
||||
trait ServiceSpecBase {
|
||||
|
||||
val request = mock[HttpServletRequest]
|
||||
val session = mock[HttpSession]
|
||||
val request = mock(classOf[HttpServletRequest])
|
||||
val session = mock(classOf[HttpSession])
|
||||
when(request.getRequestURL).thenReturn(new StringBuffer("http://localhost:8080/path.html"))
|
||||
when(request.getRequestURI).thenReturn("/path.html")
|
||||
when(request.getContextPath).thenReturn("")
|
||||
|
||||
@@ -2,9 +2,10 @@ package gitbucket.core.service
|
||||
|
||||
import gitbucket.core.api.JsonFormat
|
||||
import gitbucket.core.service.WebHookService._
|
||||
import org.scalatest.{Assertion, FunSuite}
|
||||
import org.scalatest.Assertion
|
||||
import org.scalatest.funsuite.AnyFunSuite
|
||||
|
||||
class WebHookJsonFormatSpec extends FunSuite {
|
||||
class WebHookJsonFormatSpec extends AnyFunSuite {
|
||||
import gitbucket.core.api.ApiSpecModels._
|
||||
|
||||
private def assert(payload: WebHookPayload, expected: String): Assertion = {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package gitbucket.core.service
|
||||
|
||||
import gitbucket.core.model.{WebHook, RepositoryWebHook}
|
||||
import org.scalatest.FunSuite
|
||||
import org.scalatest.funsuite.AnyFunSuite
|
||||
import gitbucket.core.model.WebHookContentType
|
||||
|
||||
class WebHookServiceSpec extends FunSuite with ServiceSpecBase {
|
||||
class WebHookServiceSpec extends AnyFunSuite with ServiceSpecBase {
|
||||
lazy val service = new WebHookPullRequestService with AccountService with ActivityService with RepositoryService
|
||||
with MergeService with PullRequestService with IssuesService with CommitsService with LabelsService
|
||||
with MilestonesService with PrioritiesService with WebHookPullRequestReviewCommentService with RequestCache
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package gitbucket.core.ssh
|
||||
|
||||
import org.apache.sshd.server.shell.UnknownCommand
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatest.funspec.AnyFunSpec
|
||||
|
||||
class GitCommandFactorySpec extends FunSpec {
|
||||
class GitCommandFactorySpec extends AnyFunSpec {
|
||||
|
||||
val factory = new GitCommandFactory("http://localhost:8080", None)
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package gitbucket.core.util
|
||||
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatest.funspec.AnyFunSpec
|
||||
|
||||
class DirectorySpec extends FunSpec {
|
||||
class DirectorySpec extends AnyFunSpec {
|
||||
|
||||
describe("GitBucketHome") {
|
||||
it("should set under target in test scope") {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package gitbucket.core.util
|
||||
|
||||
import org.scalatest.FunSuite
|
||||
import org.scalatest.funsuite.AnyFunSuite
|
||||
import GitSpecUtil._
|
||||
|
||||
class EditorConfigUtilSpec extends FunSuite {
|
||||
class EditorConfigUtilSpec extends AnyFunSuite {
|
||||
val simpleConfig =
|
||||
"""[*.txt]
|
||||
|indent_style = tab
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package gitbucket.core.util
|
||||
|
||||
import org.scalatest.FunSuite
|
||||
import org.scalatest.funsuite.AnyFunSuite
|
||||
|
||||
class HttpClientUtilSpec extends FunSuite {
|
||||
class HttpClientUtilSpec extends AnyFunSuite {
|
||||
|
||||
test("isPrivateAddress") {
|
||||
assert(HttpClientUtil.isPrivateAddress("localhost") == true)
|
||||
|
||||
@@ -4,11 +4,11 @@ import GitSpecUtil._
|
||||
import org.apache.commons.io.IOUtils
|
||||
import org.eclipse.jgit.diff.DiffEntry.ChangeType
|
||||
import org.eclipse.jgit.lib.Constants
|
||||
import org.scalatest.FunSuite
|
||||
import org.scalatest.funsuite.AnyFunSuite
|
||||
|
||||
import scala.jdk.CollectionConverters._
|
||||
|
||||
class JGitUtilSpec extends FunSuite {
|
||||
class JGitUtilSpec extends AnyFunSuite {
|
||||
|
||||
test("isEmpty") {
|
||||
withTestRepository { git =>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package gitbucket.core.util
|
||||
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatest.funspec.AnyFunSpec
|
||||
|
||||
class StringUtilSpec extends FunSpec {
|
||||
class StringUtilSpec extends AnyFunSpec {
|
||||
|
||||
describe("urlEncode") {
|
||||
it("should encode whitespace to %20") {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package gitbucket.core.util
|
||||
|
||||
import org.scalatra.i18n.Messages
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatest.funspec.AnyFunSpec
|
||||
|
||||
class ValidationsSpec extends FunSpec with Validations {
|
||||
class ValidationsSpec extends AnyFunSpec with Validations {
|
||||
|
||||
describe("identifier") {
|
||||
it("should validate id string ") {
|
||||
|
||||
@@ -9,14 +9,13 @@ import gitbucket.core.model.Account
|
||||
import gitbucket.core.service.RequestCache
|
||||
import gitbucket.core.service.SystemSettingsService.{RepositoryOperation, Ssh, SystemSettings, Upload, WebHook}
|
||||
import org.mockito.Mockito._
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatestplus.mockito.MockitoSugar
|
||||
import org.scalatest.funspec.AnyFunSpec
|
||||
import play.twirl.api.Html
|
||||
|
||||
class AvatarImageProviderSpec extends FunSpec with MockitoSugar {
|
||||
class AvatarImageProviderSpec extends AnyFunSpec {
|
||||
|
||||
val request = mock[HttpServletRequest]
|
||||
val session = mock[HttpSession]
|
||||
val request = mock(classOf[HttpServletRequest])
|
||||
val session = mock(classOf[HttpSession])
|
||||
when(request.getRequestURL).thenReturn(new StringBuffer("http://localhost:8080/path.html"))
|
||||
when(request.getRequestURI).thenReturn("/path.html")
|
||||
when(request.getContextPath).thenReturn("")
|
||||
|
||||
@@ -2,15 +2,15 @@ package gitbucket.core.view
|
||||
|
||||
import gitbucket.core.controller.Context
|
||||
import gitbucket.core.service.RepositoryService.RepositoryInfo
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatestplus.mockito.MockitoSugar
|
||||
import org.scalatest.funspec.AnyFunSpec
|
||||
import java.util.Date
|
||||
import java.util.TimeZone
|
||||
import org.mockito.Mockito._
|
||||
|
||||
class HelpersSpec extends FunSpec with MockitoSugar {
|
||||
class HelpersSpec extends AnyFunSpec {
|
||||
|
||||
private implicit val context = mock[Context]
|
||||
private val repository = mock[RepositoryInfo]
|
||||
private implicit val context = mock(classOf[Context])
|
||||
private val repository = mock(classOf[RepositoryInfo])
|
||||
|
||||
import helpers._
|
||||
|
||||
|
||||
@@ -2,11 +2,10 @@ package gitbucket.core.view
|
||||
|
||||
import gitbucket.core.controller.Context
|
||||
import gitbucket.core.service.RepositoryService.RepositoryInfo
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatestplus.mockito.MockitoSugar
|
||||
import org.scalatest.funspec.AnyFunSpec
|
||||
import org.mockito.Mockito._
|
||||
|
||||
class MarkdownSpec extends FunSpec with MockitoSugar {
|
||||
class MarkdownSpec extends AnyFunSpec {
|
||||
|
||||
import Markdown._
|
||||
|
||||
@@ -96,8 +95,8 @@ tasks
|
||||
|
||||
describe("toHtml") {
|
||||
it("should fix url at the repository root") {
|
||||
val repository = mock[RepositoryInfo]
|
||||
val context = mock[Context]
|
||||
val repository = mock(classOf[RepositoryInfo])
|
||||
val context = mock(classOf[Context])
|
||||
when(context.currentPath).thenReturn("/user/repo")
|
||||
when(repository.httpUrl(context)).thenReturn("http://localhost:8080/git/user/repo.git")
|
||||
|
||||
@@ -117,8 +116,8 @@ tasks
|
||||
}
|
||||
|
||||
it("should fix sub directory url at the file list") {
|
||||
val repository = mock[RepositoryInfo]
|
||||
val context = mock[Context]
|
||||
val repository = mock(classOf[RepositoryInfo])
|
||||
val context = mock(classOf[Context])
|
||||
when(context.currentPath).thenReturn("/user/repo/tree/master/sub/dir")
|
||||
when(repository.httpUrl(context)).thenReturn("http://localhost:8080/git/user/repo.git")
|
||||
|
||||
@@ -138,8 +137,8 @@ tasks
|
||||
}
|
||||
|
||||
it("should fix sub directory url at the blob view") {
|
||||
val repository = mock[RepositoryInfo]
|
||||
val context = mock[Context]
|
||||
val repository = mock(classOf[RepositoryInfo])
|
||||
val context = mock(classOf[Context])
|
||||
when(context.currentPath).thenReturn("/user/repo/blob/master/sub/dir/README.md")
|
||||
when(repository.httpUrl(context)).thenReturn("http://localhost:8080/git/user/repo.git")
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@ package gitbucket.core.view
|
||||
|
||||
import gitbucket.core.util.SyntaxSugars
|
||||
import SyntaxSugars._
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatest.funspec.AnyFunSpec
|
||||
|
||||
class PaginationSpec extends FunSpec {
|
||||
class PaginationSpec extends AnyFunSpec {
|
||||
|
||||
describe("max") {
|
||||
it("should return max page number") {
|
||||
|
||||
Reference in New Issue
Block a user