Skip to content

Commit 2bd4299

Browse files
committed
Fixed test: Peertube - Use new comments and videos
Old comments/videos got deleted
1 parent 606a386 commit 2bd4299

1 file changed

Lines changed: 16 additions & 11 deletions

File tree

extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubeCommentsExtractorTest.java

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,42 +28,47 @@ public static class Default {
2828
public static void setUp() throws Exception {
2929
NewPipe.init(DownloaderTestImpl.getInstance());
3030
extractor = (PeertubeCommentsExtractor) PeerTube
31-
.getCommentsExtractor("https://framatube.org/videos/watch/9c9de5e8-0a1e-484a-b099-e80766180a6d");
31+
.getCommentsExtractor("https://framatube.org/w/kkGMgK9ZtnKfYAgnEtQxbv");
3232
}
3333

3434
@Test
35-
public void testGetComments() throws IOException, ExtractionException {
35+
void testGetComments() throws IOException, ExtractionException {
36+
final String comment = "I love this";
37+
3638
InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
37-
boolean result = findInComments(comments, "Cool.");
39+
boolean result = findInComments(comments, comment);
3840

3941
while (comments.hasNextPage() && !result) {
4042
comments = extractor.getPage(comments.getNextPage());
41-
result = findInComments(comments, "Cool.");
43+
result = findInComments(comments, comment);
4244
}
4345

4446
assertTrue(result);
4547
}
4648

4749
@Test
48-
public void testGetCommentsFromCommentsInfo() throws IOException, ExtractionException {
49-
CommentsInfo commentsInfo = CommentsInfo.getInfo("https://framatube.org/videos/watch/217eefeb-883d-45be-b7fc-a788ad8507d3");
50+
void testGetCommentsFromCommentsInfo() throws IOException, ExtractionException {
51+
final String comment = "great video";
52+
53+
final CommentsInfo commentsInfo =
54+
CommentsInfo.getInfo("https://framatube.org/w/kkGMgK9ZtnKfYAgnEtQxbv");
5055
assertEquals("Comments", commentsInfo.getName());
5156

52-
boolean result = findInComments(commentsInfo.getRelatedItems(), "Cool");
57+
boolean result = findInComments(commentsInfo.getRelatedItems(), comment);
5358

5459
Page nextPage = commentsInfo.getNextPage();
5560
InfoItemsPage<CommentsInfoItem> moreItems = new InfoItemsPage<>(null, nextPage, null);
5661
while (moreItems.hasNextPage() && !result) {
5762
moreItems = CommentsInfo.getMoreItems(PeerTube, commentsInfo, nextPage);
58-
result = findInComments(moreItems.getItems(), "Cool");
63+
result = findInComments(moreItems.getItems(), comment);
5964
nextPage = moreItems.getNextPage();
6065
}
6166

6267
assertTrue(result);
6368
}
6469

6570
@Test
66-
public void testGetCommentsAllData() throws IOException, ExtractionException {
71+
void testGetCommentsAllData() throws IOException, ExtractionException {
6772
InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
6873
for (CommentsInfoItem c : comments.getItems()) {
6974
assertFalse(Utils.isBlank(c.getUploaderUrl()));
@@ -105,13 +110,13 @@ public static void setUp() throws Exception {
105110
}
106111

107112
@Test
108-
public void testGetComments() throws IOException, ExtractionException {
113+
void testGetComments() throws IOException, ExtractionException {
109114
final InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
110115
assertTrue(comments.getErrors().isEmpty());
111116
}
112117

113118
@Test
114-
public void testGetCommentsFromCommentsInfo() throws IOException, ExtractionException {
119+
void testGetCommentsFromCommentsInfo() throws IOException, ExtractionException {
115120
final CommentsInfo commentsInfo = CommentsInfo.getInfo("https://framatube.org/videos/watch/217eefeb-883d-45be-b7fc-a788ad8507d3");
116121
assertTrue(commentsInfo.getErrors().isEmpty());
117122
}

0 commit comments

Comments
 (0)