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,5 +1,6 @@
|
|||||||
package gitbucket.core.view
|
package gitbucket.core.view
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
|
|
||||||
import gitbucket.core.model.Account
|
import gitbucket.core.model.Account
|
||||||
@@ -34,18 +35,22 @@ class AvatarImageProviderSpec extends FunSpec with MockitoSugar {
|
|||||||
|
|
||||||
it("should show uploaded image even if gravatar integration is enabled") {
|
it("should show uploaded image even if gravatar integration is enabled") {
|
||||||
implicit val context = Context(createSystemSettings(true), None, request)
|
implicit val context = Context(createSystemSettings(true), None, request)
|
||||||
val provider = new AvatarImageProviderImpl(Some(createAccount(Some("icon.png"))))
|
val account = createAccount((Some("icon.png")))
|
||||||
|
val date = new SimpleDateFormat("yyyyMMddHHmmss").format(account.updatedDate)
|
||||||
|
val provider = new AvatarImageProviderImpl(Some(account))
|
||||||
|
|
||||||
assert(provider.toHtml("user", 32).toString ==
|
assert(provider.toHtml("user", 32).toString ==
|
||||||
"<img src=\"/user/_avatar\" class=\"avatar\" style=\"width: 32px; height: 32px;\" />")
|
s"""<img src="/user/_avatar?${date}" class="avatar" style="width: 32px; height: 32px;" />""")
|
||||||
}
|
}
|
||||||
|
|
||||||
it("should show local image for no image account if gravatar integration is disabled") {
|
it("should show local image for no image account if gravatar integration is disabled") {
|
||||||
implicit val context = Context(createSystemSettings(false), None, request)
|
implicit val context = Context(createSystemSettings(false), None, request)
|
||||||
val provider = new AvatarImageProviderImpl(Some(createAccount(None)))
|
val account = createAccount(None)
|
||||||
|
val date = new SimpleDateFormat("yyyyMMddHHmmss").format(account.updatedDate)
|
||||||
|
val provider = new AvatarImageProviderImpl(Some(account))
|
||||||
|
|
||||||
assert(provider.toHtml("user", 32).toString ==
|
assert(provider.toHtml("user", 32).toString ==
|
||||||
"<img src=\"/user/_avatar\" class=\"avatar\" style=\"width: 32px; height: 32px;\" />")
|
s"""<img src="/user/_avatar?${date}" class="avatar" style="width: 32px; height: 32px;" />""")
|
||||||
}
|
}
|
||||||
|
|
||||||
it("should show Gravatar image for specified mail address if gravatar integration is enabled") {
|
it("should show Gravatar image for specified mail address if gravatar integration is enabled") {
|
||||||
|
|||||||
Reference in New Issue
Block a user