Skip to content

Commit 0d9910c

Browse files
AudricVStypox
authored andcommitted
Fix SubscriptionManagerTest tests
The breakage of these tests is related to the channel tabs changes. The testRememberRecentStreams test method has been removed, as it doesn't seem to be relevant anymore to managing subscriptions.
1 parent 8fbc8ff commit 0d9910c

1 file changed

Lines changed: 2 additions & 39 deletions

File tree

app/src/androidTest/java/org/schabi/newpipe/local/subscription/SubscriptionManagerTest.java

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,13 @@
1010
import org.junit.Test;
1111
import org.schabi.newpipe.database.AppDatabase;
1212
import org.schabi.newpipe.database.feed.model.FeedGroupEntity;
13-
import org.schabi.newpipe.database.stream.model.StreamEntity;
1413
import org.schabi.newpipe.database.subscription.SubscriptionEntity;
1514
import org.schabi.newpipe.extractor.channel.ChannelInfo;
1615
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
17-
import org.schabi.newpipe.extractor.localization.DateWrapper;
18-
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
19-
import org.schabi.newpipe.extractor.stream.StreamType;
2016
import org.schabi.newpipe.testUtil.TestDatabase;
2117
import org.schabi.newpipe.testUtil.TrampolineSchedulerRule;
2218

2319
import java.io.IOException;
24-
import java.time.OffsetDateTime;
25-
import java.util.Comparator;
2620
import java.util.List;
2721

2822
public class SubscriptionManagerTest {
@@ -58,7 +52,7 @@ public void testInsert() throws ExtractionException, IOException {
5852
final ChannelInfo info = ChannelInfo.getInfo("https://www.youtube.com/c/3blue1brown");
5953
final SubscriptionEntity subscription = SubscriptionEntity.from(info);
6054

61-
manager.insertSubscription(subscription, info);
55+
manager.insertSubscription(subscription);
6256
final SubscriptionEntity readSubscription = getAssertOneSubscriptionEntity();
6357

6458
// the uid has changed, since the uid is chosen upon inserting, but the rest should match
@@ -76,7 +70,7 @@ public void testUpdateNotificationMode() throws ExtractionException, IOException
7670
final SubscriptionEntity subscription = SubscriptionEntity.from(info);
7771
subscription.setNotificationMode(0);
7872

79-
manager.insertSubscription(subscription, info);
73+
manager.insertSubscription(subscription);
8074
manager.updateNotificationMode(subscription.getServiceId(), subscription.getUrl(), 1)
8175
.blockingAwait();
8276
final SubscriptionEntity anotherSubscription = getAssertOneSubscriptionEntity();
@@ -85,35 +79,4 @@ public void testUpdateNotificationMode() throws ExtractionException, IOException
8579
assertEquals(subscription.getUrl(), anotherSubscription.getUrl());
8680
assertEquals(1, anotherSubscription.getNotificationMode());
8781
}
88-
89-
@Test
90-
public void testRememberRecentStreams() throws ExtractionException, IOException {
91-
final ChannelInfo info = ChannelInfo.getInfo("https://www.youtube.com/c/Polyphia");
92-
final List<StreamInfoItem> relatedItems = List.of(
93-
new StreamInfoItem(0, "a", "b", StreamType.VIDEO_STREAM),
94-
new StreamInfoItem(1, "c", "d", StreamType.AUDIO_STREAM),
95-
new StreamInfoItem(2, "e", "f", StreamType.AUDIO_LIVE_STREAM),
96-
new StreamInfoItem(3, "g", "h", StreamType.LIVE_STREAM));
97-
relatedItems.forEach(item -> {
98-
// these two fields must be non-null for the insert to succeed
99-
item.setUploaderUrl(info.getUrl());
100-
item.setUploaderName(info.getName());
101-
// the upload date must not be too much in the past for the item to actually be inserted
102-
item.setUploadDate(new DateWrapper(OffsetDateTime.now()));
103-
});
104-
info.setRelatedItems(relatedItems);
105-
final SubscriptionEntity subscription = SubscriptionEntity.from(info);
106-
107-
manager.insertSubscription(subscription, info);
108-
final List<StreamEntity> streams = database.streamDAO().getAll().blockingFirst();
109-
110-
assertEquals(4, streams.size());
111-
streams.sort(Comparator.comparing(StreamEntity::getServiceId));
112-
for (int i = 0; i < 4; i++) {
113-
assertEquals(relatedItems.get(0).getServiceId(), streams.get(0).getServiceId());
114-
assertEquals(relatedItems.get(0).getUrl(), streams.get(0).getUrl());
115-
assertEquals(relatedItems.get(0).getName(), streams.get(0).getTitle());
116-
assertEquals(relatedItems.get(0).getStreamType(), streams.get(0).getStreamType());
117-
}
118-
}
11982
}

0 commit comments

Comments
 (0)