Skip to content

Commit 66518ec

Browse files
committed
check wether mediaccc streams url are secure
1 parent 0cd5e05 commit 66518ec

1 file changed

Lines changed: 23 additions & 4 deletions

File tree

extractor/src/test/java/org/schabi/newpipe/extractor/services/media_ccc/MediaCCCStreamExtractorTest.java

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@
77
import org.schabi.newpipe.extractor.NewPipe;
88
import org.schabi.newpipe.extractor.exceptions.ParsingException;
99
import org.schabi.newpipe.extractor.services.media_ccc.extractors.MediaCCCStreamExtractor;
10+
import org.schabi.newpipe.extractor.stream.AudioStream;
11+
import org.schabi.newpipe.extractor.stream.VideoStream;
1012
import org.schabi.newpipe.extractor.utils.UtilsTest;
1113

1214
import java.text.ParseException;
1315
import java.text.SimpleDateFormat;
1416
import java.util.Calendar;
17+
import java.util.List;
1518

1619
import static java.util.Objects.requireNonNull;
1720
import static junit.framework.TestCase.assertEquals;
@@ -86,12 +89,20 @@ public void testUploaderAvatarUrl() throws Exception {
8689

8790
@Test
8891
public void testVideoStreams() throws Exception {
89-
assertEquals(4, extractor.getVideoStreams().size());
92+
List<VideoStream> videoStreamList = extractor.getVideoStreams();
93+
assertEquals(4, videoStreamList.size());
94+
for (VideoStream stream : videoStreamList) {
95+
assertIsSecureUrl(stream.getUrl());
96+
}
9097
}
9198

9299
@Test
93100
public void testAudioStreams() throws Exception {
94-
assertEquals(2, extractor.getAudioStreams().size());
101+
List<AudioStream> audioStreamList = extractor.getAudioStreams();
102+
assertEquals(2, audioStreamList.size());
103+
for (AudioStream stream : audioStreamList) {
104+
assertIsSecureUrl(stream.getUrl());
105+
}
95106
}
96107

97108
@Test
@@ -164,12 +175,20 @@ public void testUploaderAvatarUrl() throws Exception {
164175

165176
@Test
166177
public void testVideoStreams() throws Exception {
167-
assertEquals(8, extractor.getVideoStreams().size());
178+
List<VideoStream> videoStreamList = extractor.getVideoStreams();
179+
assertEquals(8, videoStreamList.size());
180+
for (VideoStream stream : videoStreamList) {
181+
assertIsSecureUrl(stream.getUrl());
182+
}
168183
}
169184

170185
@Test
171186
public void testAudioStreams() throws Exception {
172-
assertEquals(2, extractor.getAudioStreams().size());
187+
List<AudioStream> audioStreamList = extractor.getAudioStreams();
188+
assertEquals(2, audioStreamList.size());
189+
for (AudioStream stream : audioStreamList) {
190+
assertIsSecureUrl(stream.getUrl());
191+
}
173192
}
174193

175194
@Test

0 commit comments

Comments
 (0)