mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-11 07:55:55 +01:00
Fix TestCase
This commit is contained in:
@@ -15,24 +15,24 @@ class AvatarImageProviderSpec extends Specification {
|
|||||||
implicit val context = app.Context(createSystemSettings(true), None, null)
|
implicit val context = app.Context(createSystemSettings(true), None, null)
|
||||||
val provider = new AvatarImageProviderImpl(Some(createAccount(None)))
|
val provider = new AvatarImageProviderImpl(Some(createAccount(None)))
|
||||||
|
|
||||||
provider.toHtml("user", 20).toString mustEqual
|
provider.toHtml("user", 32).toString mustEqual
|
||||||
"<img src=\"https://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?s=20&d=retro&r=g\" class=\"avatar\" style=\"width: 20px; height: 20px;\" />"
|
"<img src=\"https://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?s=32&d=retro&r=g\" class=\"avatar\" style=\"width: 32px; height: 32px;\" />"
|
||||||
}
|
}
|
||||||
|
|
||||||
"show uploaded image even if gravatar integration is enabled" in {
|
"show uploaded image even if gravatar integration is enabled" in {
|
||||||
implicit val context = app.Context(createSystemSettings(true), None, null)
|
implicit val context = app.Context(createSystemSettings(true), None, null)
|
||||||
val provider = new AvatarImageProviderImpl(Some(createAccount(Some("icon.png"))))
|
val provider = new AvatarImageProviderImpl(Some(createAccount(Some("icon.png"))))
|
||||||
|
|
||||||
provider.toHtml("user", 20).toString mustEqual
|
provider.toHtml("user", 32).toString mustEqual
|
||||||
"<img src=\"/user/_avatar\" class=\"avatar\" style=\"width: 20px; height: 20px;\" />"
|
"<img src=\"/user/_avatar\" class=\"avatar\" style=\"width: 32px; height: 32px;\" />"
|
||||||
}
|
}
|
||||||
|
|
||||||
"show local image for no image account if gravatar integration is disabled" in {
|
"show local image for no image account if gravatar integration is disabled" in {
|
||||||
implicit val context = app.Context(createSystemSettings(false), None, null)
|
implicit val context = app.Context(createSystemSettings(false), None, null)
|
||||||
val provider = new AvatarImageProviderImpl(Some(createAccount(None)))
|
val provider = new AvatarImageProviderImpl(Some(createAccount(None)))
|
||||||
|
|
||||||
provider.toHtml("user", 20).toString mustEqual
|
provider.toHtml("user", 32).toString mustEqual
|
||||||
"<img src=\"/user/_avatar\" class=\"avatar\" style=\"width: 20px; height: 20px;\" />"
|
"<img src=\"/user/_avatar\" class=\"avatar\" style=\"width: 32px; height: 32px;\" />"
|
||||||
}
|
}
|
||||||
|
|
||||||
"show Gravatar image for specified mail address if gravatar integration is enabled" in {
|
"show Gravatar image for specified mail address if gravatar integration is enabled" in {
|
||||||
@@ -40,7 +40,7 @@ class AvatarImageProviderSpec extends Specification {
|
|||||||
val provider = new AvatarImageProviderImpl(None)
|
val provider = new AvatarImageProviderImpl(None)
|
||||||
|
|
||||||
provider.toHtml("user", 20, "hoge@hoge.com").toString mustEqual
|
provider.toHtml("user", 20, "hoge@hoge.com").toString mustEqual
|
||||||
"<img src=\"https://www.gravatar.com/avatar/4712f9b0e63f56ad952ad387eaa23b9c?s=20&d=retro&r=g\" class=\"avatar\" style=\"width: 20px; height: 20px;\" />"
|
"<img src=\"https://www.gravatar.com/avatar/4712f9b0e63f56ad952ad387eaa23b9c?s=20&d=retro&r=g\" class=\"avatar-mini\" style=\"width: 20px; height: 20px;\" />"
|
||||||
}
|
}
|
||||||
|
|
||||||
"show unknown image for unknown user if gravatar integration is enabled" in {
|
"show unknown image for unknown user if gravatar integration is enabled" in {
|
||||||
@@ -48,7 +48,7 @@ class AvatarImageProviderSpec extends Specification {
|
|||||||
val provider = new AvatarImageProviderImpl(None)
|
val provider = new AvatarImageProviderImpl(None)
|
||||||
|
|
||||||
provider.toHtml("user", 20).toString mustEqual
|
provider.toHtml("user", 20).toString mustEqual
|
||||||
"<img src=\"/_unknown/_avatar\" class=\"avatar\" style=\"width: 20px; height: 20px;\" />"
|
"<img src=\"/_unknown/_avatar\" class=\"avatar-mini\" style=\"width: 20px; height: 20px;\" />"
|
||||||
}
|
}
|
||||||
|
|
||||||
"show unknown image for specified mail address if gravatar integration is disabled" in {
|
"show unknown image for specified mail address if gravatar integration is disabled" in {
|
||||||
@@ -56,7 +56,7 @@ class AvatarImageProviderSpec extends Specification {
|
|||||||
val provider = new AvatarImageProviderImpl(None)
|
val provider = new AvatarImageProviderImpl(None)
|
||||||
|
|
||||||
provider.toHtml("user", 20, "hoge@hoge.com").toString mustEqual
|
provider.toHtml("user", 20, "hoge@hoge.com").toString mustEqual
|
||||||
"<img src=\"/_unknown/_avatar\" class=\"avatar\" style=\"width: 20px; height: 20px;\" />"
|
"<img src=\"/_unknown/_avatar\" class=\"avatar-mini\" style=\"width: 20px; height: 20px;\" />"
|
||||||
}
|
}
|
||||||
|
|
||||||
"add tooltip if it's enabled" in {
|
"add tooltip if it's enabled" in {
|
||||||
@@ -64,7 +64,7 @@ class AvatarImageProviderSpec extends Specification {
|
|||||||
val provider = new AvatarImageProviderImpl(None)
|
val provider = new AvatarImageProviderImpl(None)
|
||||||
|
|
||||||
provider.toHtml("user", 20, "hoge@hoge.com", true).toString mustEqual
|
provider.toHtml("user", 20, "hoge@hoge.com", true).toString mustEqual
|
||||||
"<img src=\"/_unknown/_avatar\" class=\"avatar\" style=\"width: 20px; height: 20px;\" data-toggle=\"tooltip\" title=\"user\"/>"
|
"<img src=\"/_unknown/_avatar\" class=\"avatar-mini\" style=\"width: 20px; height: 20px;\" data-toggle=\"tooltip\" title=\"user\"/>"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user