[Test] Add sub channel name, url and thumbnail tests
This commit is contained in:
parent
6127826571
commit
8ce711f40f
|
@ -5,6 +5,9 @@ public interface BaseStreamExtractorTest extends BaseExtractorTest {
|
|||
void testUploaderName() throws Exception;
|
||||
void testUploaderUrl() throws Exception;
|
||||
void testUploaderAvatarUrl() throws Exception;
|
||||
void testSubChannelName() throws Exception;
|
||||
void testSubChannelUrl() throws Exception;
|
||||
void testSubChannelAvatarUrl() throws Exception;
|
||||
void testThumbnailUrl() throws Exception;
|
||||
void testDescription() throws Exception;
|
||||
void testLength() throws Exception;
|
||||
|
|
|
@ -43,6 +43,8 @@ public abstract class DefaultStreamExtractorTest extends DefaultExtractorTest<St
|
|||
public abstract StreamType expectedStreamType();
|
||||
public abstract String expectedUploaderName();
|
||||
public abstract String expectedUploaderUrl();
|
||||
public String expectedSubChannelName() { return ""; } // default: there is no subchannel
|
||||
public String expectedSubChannelUrl() { return ""; } // default: there is no subchannel
|
||||
public abstract List<String> expectedDescriptionContains(); // e.g. for full links
|
||||
public abstract long expectedLength();
|
||||
public long expectedTimestamp() { return 0; } // default: there is no timestamp
|
||||
|
@ -92,6 +94,36 @@ public abstract class DefaultStreamExtractorTest extends DefaultExtractorTest<St
|
|||
assertIsSecureUrl(extractor().getUploaderAvatarUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testSubChannelName() throws Exception {
|
||||
assertEquals(expectedSubChannelName(), extractor().getSubChannelName());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testSubChannelUrl() throws Exception {
|
||||
final String subChannelUrl = extractor().getSubChannelUrl();
|
||||
assertEquals(expectedSubChannelUrl(), subChannelUrl);
|
||||
|
||||
if (!expectedSubChannelUrl().isEmpty()) {
|
||||
// this stream has a subchannel
|
||||
assertIsSecureUrl(subChannelUrl);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testSubChannelAvatarUrl() throws Exception {
|
||||
if (expectedSubChannelName().isEmpty() && expectedSubChannelUrl().isEmpty()) {
|
||||
// this stream has no subchannel
|
||||
assertEquals("", extractor().getSubChannelAvatarUrl());
|
||||
} else {
|
||||
// this stream has a subchannel
|
||||
assertIsSecureUrl(extractor().getSubChannelAvatarUrl());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testThumbnailUrl() throws Exception {
|
||||
|
|
|
@ -56,6 +56,8 @@ public class PeertubeStreamExtractorTest {
|
|||
@Override public StreamType expectedStreamType() { return StreamType.VIDEO_STREAM; }
|
||||
@Override public String expectedUploaderName() { return "Framasoft"; }
|
||||
@Override public String expectedUploaderUrl() { return "https://framatube.org/accounts/framasoft@framatube.org"; }
|
||||
@Override public String expectedSubChannelName() { return "Les vidéos de Framasoft"; }
|
||||
@Override public String expectedSubChannelUrl() { return "https://framatube.org/video-channels/bf54d359-cfad-4935-9d45-9d6be93f63e8"; }
|
||||
@Override public List<String> expectedDescriptionContains() { // CRLF line ending
|
||||
return Arrays.asList("**[Want to help to translate this video?](https://weblate.framasoft.org/projects/what-is-peertube-video/)**\r\n"
|
||||
+ "\r\n"
|
||||
|
@ -117,6 +119,8 @@ public class PeertubeStreamExtractorTest {
|
|||
@Override public StreamType expectedStreamType() { return StreamType.VIDEO_STREAM; }
|
||||
@Override public String expectedUploaderName() { return "Tomas Berezovskiy"; }
|
||||
@Override public String expectedUploaderUrl() { return "https://peertube.co.uk/accounts/tomas_berezovskiy@peertube.iriseden.eu"; }
|
||||
@Override public String expectedSubChannelName() { return "smm.expx3"; }
|
||||
@Override public String expectedSubChannelUrl() { return "https://peertube.iriseden.eu/video-channels/smm.expx3"; }
|
||||
@Override public List<String> expectedDescriptionContains() { // LF line ending
|
||||
return Arrays.asList("https://en.informnapalm.org/dpr-combatant-describes-orders-given-russian-officers/ "
|
||||
+ " The InformNapalm team received another video of a separatist prisoner of war telling about his "
|
||||
|
|
Loading…
Reference in New Issue