mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2024-12-14 14:20:33 +05:30
Change tests
This commit is contained in:
parent
c91e21b37c
commit
be562b8436
@ -22,31 +22,29 @@ public class BandcampChannelExtractorTest implements BaseChannelExtractorTest {
|
||||
@BeforeClass
|
||||
public static void setUp() throws Exception {
|
||||
NewPipe.init(DownloaderTestImpl.getInstance());
|
||||
extractor = Bandcamp.getChannelExtractor("https://npet.bandcamp.com/releases");
|
||||
extractor = Bandcamp.getChannelExtractor("https://toupie.bandcamp.com/releases");
|
||||
extractor.fetchPage();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLength() throws ExtractionException, IOException {
|
||||
assertTrue(extractor.getInitialPage().getItems().size() >= 1);
|
||||
assertTrue(extractor.getInitialPage().getItems().size() >= 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test
|
||||
public void testDescription() throws Exception {
|
||||
assertEquals("This string will be tested for in NewPipeExtractor tests.", extractor.getDescription());
|
||||
assertEquals("making music:)", extractor.getDescription());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testAvatarUrl() throws Exception {
|
||||
// Has no avatar
|
||||
assertEquals("", extractor.getAvatarUrl());
|
||||
assertTrue("unexpected avatar URL", extractor.getAvatarUrl().contains("://f4.bcbits.com/"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testBannerUrl() throws Exception {
|
||||
// Has no banner
|
||||
assertEquals("", extractor.getBannerUrl());
|
||||
assertTrue("unexpected banner URL", extractor.getBannerUrl().contains("://f4.bcbits.com/"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -76,21 +74,21 @@ public class BandcampChannelExtractorTest implements BaseChannelExtractorTest {
|
||||
|
||||
@Override
|
||||
public void testName() throws Exception {
|
||||
assertEquals("NewPipeExtractorTest", extractor.getName());
|
||||
assertEquals("toupie", extractor.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testId() throws Exception {
|
||||
assertEquals("https://npet.bandcamp.com/", extractor.getId());
|
||||
assertEquals("https://toupie.bandcamp.com/", extractor.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testUrl() throws Exception {
|
||||
assertEquals("https://npet.bandcamp.com/releases", extractor.getUrl());
|
||||
assertEquals("https://toupie.bandcamp.com", extractor.getUrl());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testOriginalUrl() throws Exception {
|
||||
assertEquals("https://npet.bandcamp.com/releases", extractor.getUrl());
|
||||
assertEquals("https://toupie.bandcamp.com", extractor.getUrl());
|
||||
}
|
||||
}
|
||||
|
@ -35,10 +35,9 @@ public class BandcampStreamExtractorTest extends DefaultStreamExtractorTest {
|
||||
@BeforeClass
|
||||
public static void setUp() throws ExtractionException, IOException {
|
||||
NewPipe.init(DownloaderTestImpl.getInstance());
|
||||
// This test track was uploaded specifically for NewPipeExtractor tests
|
||||
|
||||
extractor = (BandcampStreamExtractor) Bandcamp
|
||||
.getStreamExtractor("https://npet.bandcamp.com/track/track-1");
|
||||
.getStreamExtractor("https://teaganbear.bandcamp.com/track/just-for-the-halibut-creative-commons-attribution");
|
||||
extractor.fetchPage();
|
||||
}
|
||||
|
||||
@ -54,22 +53,22 @@ public class BandcampStreamExtractorTest extends DefaultStreamExtractorTest {
|
||||
|
||||
@Override
|
||||
public String expectedName() {
|
||||
return "Track #1";
|
||||
return "Just for the Halibut [Creative Commons: Attribution]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String expectedId() {
|
||||
return "https://npet.bandcamp.com/track/track-1";
|
||||
return "https://teaganbear.bandcamp.com/track/just-for-the-halibut-creative-commons-attribution";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String expectedUrlContains() {
|
||||
return "https://npet.bandcamp.com/track/track-1";
|
||||
return "https://teaganbear.bandcamp.com/track/just-for-the-halibut-creative-commons-attribution";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String expectedOriginalUrlContains() {
|
||||
return "https://npet.bandcamp.com/track/track-1";
|
||||
return "https://teaganbear.bandcamp.com/track/just-for-the-halibut-creative-commons-attribution";
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -79,17 +78,17 @@ public class BandcampStreamExtractorTest extends DefaultStreamExtractorTest {
|
||||
|
||||
@Override
|
||||
public String expectedUploaderName() {
|
||||
return "NewPipeExtractorTest";
|
||||
return "Teaganbear";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String expectedUploaderUrl() {
|
||||
return "https://npet.bandcamp.com/";
|
||||
return "https://teaganbear.bandcamp.com/";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> expectedDescriptionContains() {
|
||||
return Collections.singletonList("This sample track was created using MuseScore.");
|
||||
return Collections.singletonList("it's Creative Commons so feel free to use it in whatever");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -104,12 +103,12 @@ public class BandcampStreamExtractorTest extends DefaultStreamExtractorTest {
|
||||
|
||||
@Override
|
||||
public String expectedUploadDate() {
|
||||
return "2020-03-17 18:37:44.000";
|
||||
return "2019-03-10 23:00:42.000";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String expectedTextualUploadDate() {
|
||||
return "17 Mar 2020 18:37:44 GMT";
|
||||
return "10 Mar 2019 23:00:42 GMT";
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -149,7 +148,7 @@ public class BandcampStreamExtractorTest extends DefaultStreamExtractorTest {
|
||||
|
||||
@Override
|
||||
public String expectedCategory() {
|
||||
return "acoustic";
|
||||
return "dance";
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -160,7 +159,11 @@ public class BandcampStreamExtractorTest extends DefaultStreamExtractorTest {
|
||||
|
||||
@Test
|
||||
public void testTranslateIdsToUrl() throws ParsingException {
|
||||
assertEquals("https://npet.bandcamp.com/track/track-1", BandcampExtractorHelper.getStreamUrlFromIds(3775652329L, 4207805220L, "track"));
|
||||
// To add tests: look at website's source, search for `band_id` and `item_id`
|
||||
assertEquals(
|
||||
"https://teaganbear.bandcamp.com/track/just-for-the-halibut-creative-commons-attribution",
|
||||
BandcampExtractorHelper.getStreamUrlFromIds(3877364987L, 3486455278L, "track")
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user