mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Bump data client library version (#2926)
* Bump data client library version * Fix tests * Add javadocs
This commit is contained in:
parent
5419733299
commit
98d28c60a2
11 changed files with 48 additions and 22 deletions
|
|
@ -262,7 +262,7 @@ class ApacheHttpClientMediaWikiApiTest {
|
|||
fun isUserBlockedFromCommonsForTimeBlockedUser() {
|
||||
val currentDate = Date()
|
||||
val expiredDate = Date(currentDate.time + 10000)
|
||||
server.enqueue(MockResponse().setBody("<?xml version=\"1.0\"?><api><query><userinfo id=\"1000\" name=\"testusername\" blockid=\"3000\" blockedby=\"blockerusername\" blockedbyid=\"1001\" blockreason=\"testing\" blockedtimestamp=\"2018-05-24T15:32:09Z\" blockexpiry=\"" + DateUtil.getIso8601DateFormat().format(expiredDate) + "\"></userinfo></query></api>"))
|
||||
server.enqueue(MockResponse().setBody("<?xml version=\"1.0\"?><api><query><userinfo id=\"1000\" name=\"testusername\" blockid=\"3000\" blockedby=\"blockerusername\" blockedbyid=\"1001\" blockreason=\"testing\" blockedtimestamp=\"2018-05-24T15:32:09Z\" blockexpiry=\"" + DateUtil.iso8601DateFormat(expiredDate) + "\"></userinfo></query></api>"))
|
||||
|
||||
val result = testObject.isUserBlockedFromCommons()
|
||||
|
||||
|
|
@ -282,7 +282,7 @@ class ApacheHttpClientMediaWikiApiTest {
|
|||
fun isUserBlockedFromCommonsForExpiredBlockedUser() {
|
||||
val currentDate = Date()
|
||||
val expiredDate = Date(currentDate.time - 10000)
|
||||
server.enqueue(MockResponse().setBody("<?xml version=\"1.0\"?><api><query><userinfo id=\"1000\" name=\"testusername\" blockid=\"3000\" blockedby=\"blockerusername\" blockedbyid=\"1001\" blockreason=\"testing\" blockedtimestamp=\"2018-05-24T15:32:09Z\" blockexpiry=\"" + DateUtil.getIso8601DateFormat().format(expiredDate) + "\"></userinfo></query></api>"))
|
||||
server.enqueue(MockResponse().setBody("<?xml version=\"1.0\"?><api><query><userinfo id=\"1000\" name=\"testusername\" blockid=\"3000\" blockedby=\"blockerusername\" blockedbyid=\"1001\" blockreason=\"testing\" blockedtimestamp=\"2018-05-24T15:32:09Z\" blockexpiry=\"" + DateUtil.iso8601DateFormat(expiredDate) + "\"></userinfo></query></api>"))
|
||||
|
||||
val result = testObject.isUserBlockedFromCommons()
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import fr.free.nrw.commons.Media
|
|||
import fr.free.nrw.commons.TestCommonsApplication
|
||||
import fr.free.nrw.commons.kvstore.JsonKvStore
|
||||
import fr.free.nrw.commons.mwapi.OkHttpJsonApiClient.mapType
|
||||
import fr.free.nrw.commons.utils.CommonsDateUtil
|
||||
import junit.framework.Assert.assertEquals
|
||||
import okhttp3.HttpUrl
|
||||
import okhttp3.OkHttpClient
|
||||
|
|
@ -21,7 +22,6 @@ import org.mockito.Mockito
|
|||
import org.mockito.Mockito.`when`
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
import org.wikipedia.util.DateUtil
|
||||
import java.util.*
|
||||
import kotlin.random.Random
|
||||
|
||||
|
|
@ -190,7 +190,7 @@ class OkHttpJsonApiClientTest {
|
|||
*/
|
||||
@Test
|
||||
fun getImageWithGenerator() {
|
||||
val template = "Template:Potd/" + DateUtil.getIso8601DateFormatShort().format(Date())
|
||||
val template = "Template:Potd/" + CommonsDateUtil.getIso8601DateFormatShort().format(Date())
|
||||
server.enqueue(getMediaList("", "", "", 1))
|
||||
|
||||
val media = testObject.getMedia(template, true)!!.blockingGet()
|
||||
|
|
@ -216,7 +216,7 @@ class OkHttpJsonApiClientTest {
|
|||
*/
|
||||
@Test
|
||||
fun getPictureOfTheDay() {
|
||||
val template = "Template:Potd/" + DateUtil.getIso8601DateFormatShort().format(Date())
|
||||
val template = "Template:Potd/" + CommonsDateUtil.getIso8601DateFormatShort().format(Date())
|
||||
server.enqueue(getMediaList("", "", "", 1))
|
||||
|
||||
val media = testObject.pictureOfTheDay?.blockingGet()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue