[PeerTube] Apply changes in extractor tests
Also remove some public test methods modifiers, add missing Test annotations on old Junit 4 tests (and update them if needed), and improve some code.
This commit is contained in:
parent
1d72bac53d
commit
ba5315c72d
|
@ -15,9 +15,10 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
|
|
||||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertTabsContain;
|
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertTabsContain;
|
||||||
|
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertEmpty;
|
||||||
import static org.schabi.newpipe.extractor.ServiceList.PeerTube;
|
import static org.schabi.newpipe.extractor.ServiceList.PeerTube;
|
||||||
|
import static org.schabi.newpipe.extractor.services.DefaultTests.defaultTestImageCollection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for {@link PeertubeAccountExtractor}
|
* Test for {@link PeertubeAccountExtractor}
|
||||||
|
@ -76,13 +77,13 @@ public class PeertubeAccountExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAvatarUrl() throws ParsingException {
|
public void testAvatars() {
|
||||||
assertIsSecureUrl(extractor.getAvatarUrl());
|
defaultTestImageCollection(extractor.getAvatars());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBannerUrl() {
|
public void testBanners() {
|
||||||
assertNull(extractor.getBannerUrl());
|
assertEmpty(extractor.getBanners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -95,6 +96,7 @@ public class PeertubeAccountExtractorTest {
|
||||||
ExtractorAsserts.assertGreaterOrEqual(700, extractor.getSubscriberCount());
|
ExtractorAsserts.assertGreaterOrEqual(700, extractor.getSubscriberCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@Override
|
@Override
|
||||||
public void testVerified() throws Exception {
|
public void testVerified() throws Exception {
|
||||||
assertFalse(extractor.isVerified());
|
assertFalse(extractor.isVerified());
|
||||||
|
@ -160,18 +162,18 @@ public class PeertubeAccountExtractorTest {
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDescription() throws ParsingException {
|
public void testDescription() {
|
||||||
assertNotNull(extractor.getDescription());
|
assertNotNull(extractor.getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAvatarUrl() throws ParsingException {
|
public void testAvatars() {
|
||||||
assertIsSecureUrl(extractor.getAvatarUrl());
|
defaultTestImageCollection(extractor.getAvatars());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBannerUrl() throws ParsingException {
|
public void testBanners() {
|
||||||
assertNull(extractor.getBannerUrl());
|
assertEmpty(extractor.getBanners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -184,6 +186,7 @@ public class PeertubeAccountExtractorTest {
|
||||||
ExtractorAsserts.assertGreaterOrEqual(100, extractor.getSubscriberCount());
|
ExtractorAsserts.assertGreaterOrEqual(100, extractor.getSubscriberCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@Override
|
@Override
|
||||||
public void testVerified() throws Exception {
|
public void testVerified() throws Exception {
|
||||||
assertFalse(extractor.isVerified());
|
assertFalse(extractor.isVerified());
|
||||||
|
|
|
@ -3,7 +3,6 @@ package org.schabi.newpipe.extractor.services.peertube;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.schabi.newpipe.downloader.DownloaderTestImpl;
|
import org.schabi.newpipe.downloader.DownloaderTestImpl;
|
||||||
import org.schabi.newpipe.extractor.ExtractorAsserts;
|
|
||||||
import org.schabi.newpipe.extractor.NewPipe;
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
import org.schabi.newpipe.extractor.channel.tabs.ChannelTabs;
|
import org.schabi.newpipe.extractor.channel.tabs.ChannelTabs;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||||
|
@ -13,11 +12,12 @@ import org.schabi.newpipe.extractor.services.peertube.extractors.PeertubeChannel
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
|
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertEmpty;
|
||||||
|
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertGreaterOrEqual;
|
||||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertTabsContain;
|
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertTabsContain;
|
||||||
import static org.schabi.newpipe.extractor.ServiceList.PeerTube;
|
import static org.schabi.newpipe.extractor.ServiceList.PeerTube;
|
||||||
|
import static org.schabi.newpipe.extractor.services.DefaultTests.defaultTestImageCollection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for {@link PeertubeChannelExtractor}
|
* Test for {@link PeertubeChannelExtractor}
|
||||||
|
@ -71,33 +71,33 @@ public class PeertubeChannelExtractorTest {
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDescription() throws ParsingException {
|
public void testDescription() {
|
||||||
assertNotNull(extractor.getDescription());
|
assertNotNull(extractor.getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParentChannelName() throws ParsingException {
|
void testParentChannelName() throws ParsingException {
|
||||||
assertEquals("lqdn", extractor.getParentChannelName());
|
assertEquals("lqdn", extractor.getParentChannelName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParentChannelUrl() throws ParsingException {
|
void testParentChannelUrl() throws ParsingException {
|
||||||
assertEquals("https://video.lqdn.fr/accounts/lqdn", extractor.getParentChannelUrl());
|
assertEquals("https://video.lqdn.fr/accounts/lqdn", extractor.getParentChannelUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParentChannelAvatarUrl() throws ParsingException {
|
void testParentChannelAvatarUrl() {
|
||||||
assertIsSecureUrl(extractor.getParentChannelAvatarUrl());
|
defaultTestImageCollection(extractor.getParentChannelAvatars());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAvatarUrl() throws ParsingException {
|
public void testAvatars() {
|
||||||
assertIsSecureUrl(extractor.getAvatarUrl());
|
defaultTestImageCollection(extractor.getAvatars());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBannerUrl() throws ParsingException {
|
public void testBanners() {
|
||||||
assertNull(extractor.getBannerUrl());
|
assertEmpty(extractor.getBanners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -106,10 +106,11 @@ public class PeertubeChannelExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSubscriberCount() throws ParsingException {
|
public void testSubscriberCount() {
|
||||||
ExtractorAsserts.assertGreaterOrEqual(230, extractor.getSubscriberCount());
|
assertGreaterOrEqual(230, extractor.getSubscriberCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@Override
|
@Override
|
||||||
public void testVerified() throws Exception {
|
public void testVerified() throws Exception {
|
||||||
assertFalse(extractor.isVerified());
|
assertFalse(extractor.isVerified());
|
||||||
|
@ -176,33 +177,33 @@ public class PeertubeChannelExtractorTest {
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDescription() throws ParsingException {
|
public void testDescription() {
|
||||||
assertNotNull(extractor.getDescription());
|
assertNotNull(extractor.getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParentChannelName() throws ParsingException {
|
void testParentChannelName() throws ParsingException {
|
||||||
assertEquals("nathan", extractor.getParentChannelName());
|
assertEquals("nathan", extractor.getParentChannelName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParentChannelUrl() throws ParsingException {
|
void testParentChannelUrl() throws ParsingException {
|
||||||
assertEquals("https://skeptikon.fr/accounts/nathan", extractor.getParentChannelUrl());
|
assertEquals("https://skeptikon.fr/accounts/nathan", extractor.getParentChannelUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParentChannelAvatarUrl() throws ParsingException {
|
void testParentChannelAvatars() {
|
||||||
assertIsSecureUrl(extractor.getParentChannelAvatarUrl());
|
defaultTestImageCollection(extractor.getParentChannelAvatars());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAvatarUrl() throws ParsingException {
|
public void testAvatars() {
|
||||||
assertIsSecureUrl(extractor.getAvatarUrl());
|
defaultTestImageCollection(extractor.getAvatars());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBannerUrl() throws ParsingException {
|
public void testBanners() throws ParsingException {
|
||||||
assertNull(extractor.getBannerUrl());
|
assertEmpty(extractor.getBanners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -211,10 +212,11 @@ public class PeertubeChannelExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSubscriberCount() throws ParsingException {
|
public void testSubscriberCount() {
|
||||||
ExtractorAsserts.assertGreaterOrEqual(700, extractor.getSubscriberCount());
|
assertGreaterOrEqual(700, extractor.getSubscriberCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@Override
|
@Override
|
||||||
public void testVerified() throws Exception {
|
public void testVerified() throws Exception {
|
||||||
assertFalse(extractor.isVerified());
|
assertFalse(extractor.isVerified());
|
||||||
|
|
|
@ -18,6 +18,7 @@ import java.util.Optional;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
import static org.schabi.newpipe.extractor.ServiceList.PeerTube;
|
import static org.schabi.newpipe.extractor.ServiceList.PeerTube;
|
||||||
|
import static org.schabi.newpipe.extractor.services.DefaultTests.defaultTestImageCollection;
|
||||||
|
|
||||||
public class PeertubeCommentsExtractorTest {
|
public class PeertubeCommentsExtractorTest {
|
||||||
public static class Default {
|
public static class Default {
|
||||||
|
@ -73,12 +74,12 @@ public class PeertubeCommentsExtractorTest {
|
||||||
.forEach(commentsInfoItem -> {
|
.forEach(commentsInfoItem -> {
|
||||||
assertFalse(Utils.isBlank(commentsInfoItem.getUploaderUrl()));
|
assertFalse(Utils.isBlank(commentsInfoItem.getUploaderUrl()));
|
||||||
assertFalse(Utils.isBlank(commentsInfoItem.getUploaderName()));
|
assertFalse(Utils.isBlank(commentsInfoItem.getUploaderName()));
|
||||||
assertFalse(Utils.isBlank(commentsInfoItem.getUploaderAvatarUrl()));
|
defaultTestImageCollection(commentsInfoItem.getUploaderAvatars());
|
||||||
assertFalse(Utils.isBlank(commentsInfoItem.getCommentId()));
|
assertFalse(Utils.isBlank(commentsInfoItem.getCommentId()));
|
||||||
assertFalse(Utils.isBlank(commentsInfoItem.getCommentText().getContent()));
|
assertFalse(Utils.isBlank(commentsInfoItem.getCommentText().getContent()));
|
||||||
assertFalse(Utils.isBlank(commentsInfoItem.getName()));
|
assertFalse(Utils.isBlank(commentsInfoItem.getName()));
|
||||||
assertFalse(Utils.isBlank(commentsInfoItem.getTextualUploadDate()));
|
assertFalse(Utils.isBlank(commentsInfoItem.getTextualUploadDate()));
|
||||||
assertFalse(Utils.isBlank(commentsInfoItem.getThumbnailUrl()));
|
defaultTestImageCollection(commentsInfoItem.getThumbnails());
|
||||||
assertFalse(Utils.isBlank(commentsInfoItem.getUrl()));
|
assertFalse(Utils.isBlank(commentsInfoItem.getUrl()));
|
||||||
assertEquals(-1, commentsInfoItem.getLikeCount());
|
assertEquals(-1, commentsInfoItem.getLikeCount());
|
||||||
assertTrue(Utils.isBlank(commentsInfoItem.getTextualLikeCount()));
|
assertTrue(Utils.isBlank(commentsInfoItem.getTextualLikeCount()));
|
||||||
|
|
|
@ -2,9 +2,9 @@ package org.schabi.newpipe.extractor.services.peertube;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.schabi.newpipe.extractor.ServiceList.PeerTube;
|
import static org.schabi.newpipe.extractor.ServiceList.PeerTube;
|
||||||
|
import static org.schabi.newpipe.extractor.services.DefaultTests.defaultTestImageCollection;
|
||||||
|
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.Disabled;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.schabi.newpipe.downloader.DownloaderTestImpl;
|
import org.schabi.newpipe.downloader.DownloaderTestImpl;
|
||||||
import org.schabi.newpipe.extractor.ExtractorAsserts;
|
import org.schabi.newpipe.extractor.ExtractorAsserts;
|
||||||
|
@ -31,11 +31,8 @@ public class PeertubePlaylistExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Disabled("URL changes with every request")
|
void testGetThumbnails() throws ParsingException {
|
||||||
void testGetThumbnailUrl() throws ParsingException {
|
defaultTestImageCollection(extractor.getThumbnails());
|
||||||
assertEquals(
|
|
||||||
"https://framatube.org/static/thumbnails/playlist-96b0ee2b-a5a7-4794-8769-58d8ccb79ab7.jpg",
|
|
||||||
extractor.getThumbnailUrl());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -44,10 +41,8 @@ public class PeertubePlaylistExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGetUploaderAvatarUrl() throws ParsingException {
|
void testGetUploaderAvatars() throws ParsingException {
|
||||||
assertEquals(
|
defaultTestImageCollection(extractor.getUploaderAvatars());
|
||||||
"https://framatube.org/lazy-static/avatars/c6801ff9-cb49-42e6-b2db-3db623248115.jpg",
|
|
||||||
extractor.getUploaderAvatarUrl());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -76,10 +71,8 @@ public class PeertubePlaylistExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGetSubChannelAvatarUrl() throws ParsingException {
|
void testGetSubChannelAvatars() throws ParsingException {
|
||||||
assertEquals(
|
defaultTestImageCollection(extractor.getSubChannelAvatars());
|
||||||
"https://framatube.org/lazy-static/avatars/e801ccce-8694-4309-b0ab-e6f0e552ef77.png",
|
|
||||||
extractor.getSubChannelAvatarUrl());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue