Added update config builder. Closes #8
This commit is contained in:
parent
82d31578c8
commit
31f5aac584
7 changed files with 225 additions and 4 deletions
|
@ -200,6 +200,34 @@ class BitlyTest {
|
|||
assertThat(bl.lastCallResponse).prop(CallResponse::isUnprocessableEntity).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `update bitlink with config`() {
|
||||
val bl = bitly.bitlinks()
|
||||
var config = UpdateConfig.Builder().apply {
|
||||
bitlink(shortUrl)
|
||||
title("Erik's Weblog")
|
||||
tags(arrayOf("blog", "weblog"))
|
||||
archived(true)
|
||||
}.build()
|
||||
|
||||
assertEquals(Constants.TRUE, bl.update(config))
|
||||
|
||||
config = UpdateConfig.Builder().apply {
|
||||
bitlink(shortUrl)
|
||||
toJson(true)
|
||||
}.build()
|
||||
|
||||
assertThat(bl.update(config), "update(tags)").contains("\"tags\":[]")
|
||||
|
||||
config = UpdateConfig.Builder().apply {
|
||||
bitlink(shortUrl)
|
||||
link(longUrl)
|
||||
}.build()
|
||||
bl.update(config)
|
||||
|
||||
assertThat(bl.lastCallResponse).prop(CallResponse::isUnprocessableEntity).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `validate URL`() {
|
||||
assertTrue("https://www.example.com".isValidUrl(), "valid url")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue