add unit test for token type serialization
This commit is contained in:
parent
3cadaa5c7a
commit
127bd030b9
|
@ -1,17 +0,0 @@
|
|||
package org.mosad.teapod
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package org.mosad.teapod.parser.crunchyroll
|
||||
|
||||
import kotlinx.serialization.decodeFromString
|
||||
import kotlinx.serialization.json.Json
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
|
||||
class DataTypesTest {
|
||||
|
||||
@Test
|
||||
fun testTokenType() {
|
||||
val testToken = javaClass.getResource("/token.json")!!.readText()
|
||||
val token: Token = Json.decodeFromString(testToken)
|
||||
|
||||
Assert.assertEquals("TestAccessToken-1_TestAccessToken", token.accessToken)
|
||||
Assert.assertEquals("00000000-0000-0000-0000-000000000000", token.refreshToken)
|
||||
Assert.assertEquals(300, token.expiresIn)
|
||||
Assert.assertEquals("Bearer", token.tokenType)
|
||||
Assert.assertEquals("account content offline_access reviews talkbox", token.scope)
|
||||
Assert.assertEquals("DE", token.country)
|
||||
Assert.assertEquals("00000000-0000-0000-0000-000000000000", token.accountId)
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"access_token":"TestAccessToken-1_TestAccessToken",
|
||||
"refresh_token":"00000000-0000-0000-0000-000000000000",
|
||||
"expires_in":300,
|
||||
"token_type":"Bearer",
|
||||
"scope":"account content offline_access reviews talkbox",
|
||||
"country":"DE",
|
||||
"account_id":"00000000-0000-0000-0000-000000000000"
|
||||
}
|
Loading…
Reference in New Issue