mirror of
https://github.com/Athou/commafeed.git
synced 2026-09-22 12:04:16 +00:00
correctly handle root favicons for non-default ports
This commit is contained in:
@@ -47,6 +47,26 @@ class RootFaviconFetcherTest {
|
||||
Assertions.assertTrue(result.mediaType().isCompatible(MediaType.valueOf(contentType)));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFetchUsesLinkWhenAvailableWithNonDefaultPort() throws Exception {
|
||||
Feed feed = new Feed();
|
||||
feed.setUrl("https://feeds.example.com:8000/feed");
|
||||
feed.setLink("https://www.example.com:8000/blog");
|
||||
|
||||
byte[] iconBytes = new byte[1000];
|
||||
String contentType = "image/x-icon";
|
||||
HttpResult httpResult =
|
||||
new HttpResult(iconBytes, contentType, null, null, null, Duration.ZERO);
|
||||
Mockito.when(httpGetter.get("https://www.example.com:8000/favicon.ico"))
|
||||
.thenReturn(httpResult);
|
||||
|
||||
Favicon result = faviconFetcher.fetch(feed);
|
||||
|
||||
Assertions.assertNotNull(result);
|
||||
Assertions.assertEquals(iconBytes, result.icon());
|
||||
Assertions.assertTrue(result.mediaType().isCompatible(MediaType.valueOf(contentType)));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFetchFallsBackToUrlWhenLinkIsNull() throws Exception {
|
||||
Feed feed = new Feed();
|
||||
|
||||
Reference in New Issue
Block a user