1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

Reformat some webfinger classes

This commit is contained in:
Abel García de Prada 2022-10-13 10:22:39 +02:00
parent 70bf35f683
commit e769684920
6 changed files with 37 additions and 42 deletions

View File

@ -11,8 +11,7 @@ import java.io.File
class WebfingerResponseTest { class WebfingerResponseTest {
lateinit var adapter: JsonAdapter<WebfingerJrdResponse> lateinit var adapter: JsonAdapter<WebfingerJrdResponse>
private fun loadResponses(fileName: String) = private fun loadResponses(fileName: String) = adapter.fromJson(File(fileName).readText())
adapter.fromJson(File(fileName).readText())
@Before @Before
fun prepare() { fun prepare() {
@ -21,8 +20,8 @@ class WebfingerResponseTest {
} }
@Test @Test
fun `check rel in to much information - ok - correct rell is returned`() { fun `check rel in too much information - ok`() {
val response = loadResponses(TO_MUCH_INFORMATION_JSON)!! val response = loadResponses(TOO_MUCH_INFORMATION_JSON)!!
Assert.assertEquals("https://gast.somedomain.de", response.links[0].href) Assert.assertEquals("https://gast.somedomain.de", response.links[0].href)
Assert.assertEquals("http://webfinger.owncloud/rel/server-instance", response.links[0].rel) Assert.assertEquals("http://webfinger.owncloud/rel/server-instance", response.links[0].rel)
} }
@ -40,11 +39,11 @@ class WebfingerResponseTest {
} }
companion object { companion object {
val RESOURCES_PATH = private const val RESOURCES_PATH =
"src/test/responses/com.owncloud.android.lib.resources.webfinger.responses" "src/test/responses/com.owncloud.android.lib.resources.webfinger.responses"
val EXAMPLE_RESPONSE_JSON = "$RESOURCES_PATH/simple_response.json" private const val EXAMPLE_RESPONSE_JSON = "$RESOURCES_PATH/simple_response.json"
val TO_MUCH_INFORMATION_JSON = "$RESOURCES_PATH/to_much_information_response.json" private const val TOO_MUCH_INFORMATION_JSON = "$RESOURCES_PATH/to_much_information_response.json"
val BROKEN_JSON = "$RESOURCES_PATH/broken_response.json" private const val BROKEN_JSON = "$RESOURCES_PATH/broken_response.json"
val NOT_CONTAINING_RELEVANT_INFORMATION_JSON = "$RESOURCES_PATH/not_containing_relevant_info_response.json" private const val NOT_CONTAINING_RELEVANT_INFORMATION_JSON = "$RESOURCES_PATH/not_containing_relevant_info_response.json"
} }
} }

View File

@ -1,10 +0,0 @@
{
"subject": "acct:peter.sine@gurken.xxx",
"links" :
[
{
"rel" : "http://webfinger.example/rel/businesscard",
"href" : "https://www.example.com/~bob/bob.vcf"
}
]
}

View File

@ -0,0 +1,9 @@
{
"subject": "acct:peter.sine@gurken.xxx",
"links": [
{
"rel": "http://webfinger.example/rel/businesscard",
"href": "https://www.example.com/~bob/bob.vcf"
}
]
}

View File

@ -1,18 +1,15 @@
{ {
"subject": "acct:peter.sine@gurken.xxx", "subject": "acct:peter.sine@gurken.xxx",
"aliases" : "aliases": [
[
"https://www.example.com/~bob/" "https://www.example.com/~bob/"
], ],
"properties" : "properties": {
{
"http://example.com/ns/role": "employee" "http://example.com/ns/role": "employee"
}, },
"gurken": { "gurken": {
"whatever": 42 "whatever": 42
}, },
"links" : "links": [
[
{ {
"gurken": "sallat", "gurken": "sallat",
"href": "https://gast.somedomain.de", "href": "https://gast.somedomain.de",