Added Bitlinks.update() method.

This commit is contained in:
Erik C. Thauvin 2020-03-03 13:25:04 -08:00
parent 95bea38c92
commit b10721573a
23 changed files with 137 additions and 34 deletions

View file

@ -34,7 +34,6 @@ package net.thauvin.erik.bitly
import net.thauvin.erik.bitly.Utils.Companion.removeHttp
import net.thauvin.erik.bitly.Utils.Companion.toEndPoint
import org.json.JSONObject
import org.junit.Before
import java.io.File
import java.util.logging.Level
@ -97,16 +96,16 @@ class BitlyTest {
@Test
fun `get user`() {
assertTrue(bitly.call("/user".toEndPoint(), method = Methods.GET).contains("\"login\":"))
assertTrue(bitly.call("/user".toEndPoint(), method = Methods.GET).isSuccessful)
}
@Test
fun `created by`() {
assertEquals(
"ethauvin",
JSONObject(
bitly.call("/bitlinks/${shortUrl.removeHttp()}".toEndPoint(), method = Methods.GET)
).getString("created_by")
bitly.call("/bitlinks/${shortUrl.removeHttp()}".toEndPoint(), method = Methods.GET)
.toJson()
.getString("created_by")
)
}
@ -138,4 +137,12 @@ class BitlyTest {
)
)
}
@Test
fun `update bitlink`() {
assertEquals(
Constants.TRUE,
bitly.bitlinks().update(shortUrl, title = "Erik's Weblog", tags = arrayOf("blog", "weblog"))
)
}
}