mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 02:17:41 +00:00 
			
		
		
		
	Reformat some webfinger classes
This commit is contained in:
		
							parent
							
								
									70bf35f683
								
							
						
					
					
						commit
						e769684920
					
				| @ -27,13 +27,13 @@ package com.owncloud.android.lib.resources.webfinger.responses | ||||
| import com.squareup.moshi.JsonClass | ||||
| 
 | ||||
| @JsonClass(generateAdapter = true) | ||||
| data class WebfingerJrdResponse ( | ||||
|     val subject:String, | ||||
|     val links:List<LinkItem> | ||||
| data class WebfingerJrdResponse( | ||||
|     val subject: String, | ||||
|     val links: List<LinkItem> | ||||
| ) | ||||
| 
 | ||||
| @JsonClass(generateAdapter = true) | ||||
| data class LinkItem( | ||||
|     val href:String, | ||||
|     val rel:String | ||||
|     val href: String, | ||||
|     val rel: String | ||||
| ) | ||||
| @ -11,8 +11,7 @@ import java.io.File | ||||
| class WebfingerResponseTest { | ||||
|     lateinit var adapter: JsonAdapter<WebfingerJrdResponse> | ||||
| 
 | ||||
|     private fun loadResponses(fileName: String) = | ||||
|         adapter.fromJson(File(fileName).readText()) | ||||
|     private fun loadResponses(fileName: String) = adapter.fromJson(File(fileName).readText()) | ||||
| 
 | ||||
|     @Before | ||||
|     fun prepare() { | ||||
| @ -21,8 +20,8 @@ class WebfingerResponseTest { | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     fun `check rel in to much information - ok - correct rell is returned`() { | ||||
|         val response = loadResponses(TO_MUCH_INFORMATION_JSON)!! | ||||
|     fun `check rel in too much information - ok`() { | ||||
|         val response = loadResponses(TOO_MUCH_INFORMATION_JSON)!! | ||||
|         Assert.assertEquals("https://gast.somedomain.de", response.links[0].href) | ||||
|         Assert.assertEquals("http://webfinger.owncloud/rel/server-instance", response.links[0].rel) | ||||
|     } | ||||
| @ -40,11 +39,11 @@ class WebfingerResponseTest { | ||||
|     } | ||||
| 
 | ||||
|     companion object { | ||||
|         val RESOURCES_PATH = | ||||
|         private const val RESOURCES_PATH = | ||||
|             "src/test/responses/com.owncloud.android.lib.resources.webfinger.responses" | ||||
|         val EXAMPLE_RESPONSE_JSON = "$RESOURCES_PATH/simple_response.json" | ||||
|         val TO_MUCH_INFORMATION_JSON = "$RESOURCES_PATH/to_much_information_response.json" | ||||
|         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 EXAMPLE_RESPONSE_JSON = "$RESOURCES_PATH/simple_response.json" | ||||
|         private const val TOO_MUCH_INFORMATION_JSON = "$RESOURCES_PATH/to_much_information_response.json" | ||||
|         private const val BROKEN_JSON = "$RESOURCES_PATH/broken_response.json" | ||||
|         private const val NOT_CONTAINING_RELEVANT_INFORMATION_JSON = "$RESOURCES_PATH/not_containing_relevant_info_response.json" | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -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" | ||||
|     } | ||||
|   ] | ||||
| } | ||||
| @ -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" | ||||
|     } | ||||
|   ] | ||||
| } | ||||
| @ -1,9 +1,9 @@ | ||||
| { | ||||
|     "links": [ | ||||
|         { | ||||
|             "href": "https://gast.somedomain.de", | ||||
|             "rel": "http://webfinger.owncloud/rel/server-instance" | ||||
|         } | ||||
|     ], | ||||
|     "subject": "acct:peter.sine@gurken.xxx" | ||||
|   "links": [ | ||||
|     { | ||||
|       "href": "https://gast.somedomain.de", | ||||
|       "rel": "http://webfinger.owncloud/rel/server-instance" | ||||
|     } | ||||
|   ], | ||||
|   "subject": "acct:peter.sine@gurken.xxx" | ||||
| } | ||||
|  | ||||
| @ -1,18 +1,15 @@ | ||||
| { | ||||
|   "subject": "acct:peter.sine@gurken.xxx", | ||||
|   "aliases" : | ||||
|   [ | ||||
|   "aliases": [ | ||||
|     "https://www.example.com/~bob/" | ||||
|   ], | ||||
|   "properties" : | ||||
|   { | ||||
|     "http://example.com/ns/role" : "employee" | ||||
|   "properties": { | ||||
|     "http://example.com/ns/role": "employee" | ||||
|   }, | ||||
|   "gurken": { | ||||
|     "whatever": 42 | ||||
|   }, | ||||
|   "links" : | ||||
|   [ | ||||
|   "links": [ | ||||
|     { | ||||
|       "gurken": "sallat", | ||||
|       "href": "https://gast.somedomain.de", | ||||
| @ -20,8 +17,8 @@ | ||||
|     }, | ||||
|     { | ||||
|       "gurken": "sallat", | ||||
|       "rel" : "http://webfinger.example/rel/businesscard", | ||||
|       "href" : "https://www.example.com/~bob/bob.vcf" | ||||
|       "rel": "http://webfinger.example/rel/businesscard", | ||||
|       "href": "https://www.example.com/~bob/bob.vcf" | ||||
|     } | ||||
|   ] | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user