Fixed test: Peertube - Use new comments and videos

Old comments/videos got deleted
This commit is contained in:
litetex 2022-03-14 21:23:31 +01:00
parent 606a386a98
commit 2bd4299563

View file

@ -28,34 +28,39 @@ public class PeertubeCommentsExtractorTest {
public static void setUp() throws Exception {
NewPipe.init(DownloaderTestImpl.getInstance());
extractor = (PeertubeCommentsExtractor) PeerTube
.getCommentsExtractor("https://framatube.org/videos/watch/9c9de5e8-0a1e-484a-b099-e80766180a6d");
.getCommentsExtractor("https://framatube.org/w/kkGMgK9ZtnKfYAgnEtQxbv");
}
@Test
public void testGetComments() throws IOException, ExtractionException {
void testGetComments() throws IOException, ExtractionException {
final String comment = "I love this";
InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
boolean result = findInComments(comments, "Cool.");
boolean result = findInComments(comments, comment);
while (comments.hasNextPage() && !result) {
comments = extractor.getPage(comments.getNextPage());
result = findInComments(comments, "Cool.");
result = findInComments(comments, comment);
}
assertTrue(result);
}
@Test
public void testGetCommentsFromCommentsInfo() throws IOException, ExtractionException {
CommentsInfo commentsInfo = CommentsInfo.getInfo("https://framatube.org/videos/watch/217eefeb-883d-45be-b7fc-a788ad8507d3");
void testGetCommentsFromCommentsInfo() throws IOException, ExtractionException {
final String comment = "great video";
final CommentsInfo commentsInfo =
CommentsInfo.getInfo("https://framatube.org/w/kkGMgK9ZtnKfYAgnEtQxbv");
assertEquals("Comments", commentsInfo.getName());
boolean result = findInComments(commentsInfo.getRelatedItems(), "Cool");
boolean result = findInComments(commentsInfo.getRelatedItems(), comment);
Page nextPage = commentsInfo.getNextPage();
InfoItemsPage<CommentsInfoItem> moreItems = new InfoItemsPage<>(null, nextPage, null);
while (moreItems.hasNextPage() && !result) {
moreItems = CommentsInfo.getMoreItems(PeerTube, commentsInfo, nextPage);
result = findInComments(moreItems.getItems(), "Cool");
result = findInComments(moreItems.getItems(), comment);
nextPage = moreItems.getNextPage();
}
@ -63,7 +68,7 @@ public class PeertubeCommentsExtractorTest {
}
@Test
public void testGetCommentsAllData() throws IOException, ExtractionException {
void testGetCommentsAllData() throws IOException, ExtractionException {
InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
for (CommentsInfoItem c : comments.getItems()) {
assertFalse(Utils.isBlank(c.getUploaderUrl()));
@ -105,13 +110,13 @@ public class PeertubeCommentsExtractorTest {
}
@Test
public void testGetComments() throws IOException, ExtractionException {
void testGetComments() throws IOException, ExtractionException {
final InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
assertTrue(comments.getErrors().isEmpty());
}
@Test
public void testGetCommentsFromCommentsInfo() throws IOException, ExtractionException {
void testGetCommentsFromCommentsInfo() throws IOException, ExtractionException {
final CommentsInfo commentsInfo = CommentsInfo.getInfo("https://framatube.org/videos/watch/217eefeb-883d-45be-b7fc-a788ad8507d3");
assertTrue(commentsInfo.getErrors().isEmpty());
}