Rewrite sources. Implement Batoto and Kissmanga

This commit is contained in:
len
2016-03-22 19:00:05 +01:00
parent bc3d5dc863
commit dd5692bb2d
36 changed files with 1516 additions and 2571 deletions

View File

@@ -17,7 +17,7 @@ import eu.kanade.tachiyomi.BuildConfig;
import eu.kanade.tachiyomi.CustomRobolectricGradleTestRunner;
import eu.kanade.tachiyomi.data.database.models.Chapter;
import eu.kanade.tachiyomi.data.database.models.Manga;
import eu.kanade.tachiyomi.data.source.base.Source;
import eu.kanade.tachiyomi.data.source.base.OnlineSource;
import rx.Observable;
import static org.assertj.core.api.Assertions.assertThat;
@@ -32,14 +32,14 @@ public class LibraryUpdateServiceTest {
ShadowApplication app;
Context context;
LibraryUpdateService service;
Source source;
OnlineSource source;
@Before
public void setup() {
app = ShadowApplication.getInstance();
context = app.getApplicationContext();
service = Robolectric.setupService(LibraryUpdateService.class);
source = mock(Source.class);
source = mock(OnlineSource.class);
when(service.sourceManager.get(anyInt())).thenReturn(source);
}
@@ -62,7 +62,7 @@ public class LibraryUpdateServiceTest {
List<Chapter> sourceChapters = createChapters("/chapter1", "/chapter2");
when(source.pullChaptersFromNetwork(manga.url)).thenReturn(Observable.just(sourceChapters));
when(source.fetchChapterList(manga)).thenReturn(Observable.just(sourceChapters));
service.updateManga(manga).subscribe();
@@ -79,9 +79,9 @@ public class LibraryUpdateServiceTest {
List<Chapter> chapters3 = createChapters("/achapter1", "/achapter2");
// One of the updates will fail
when(source.pullChaptersFromNetwork("/manga1")).thenReturn(Observable.just(chapters));
when(source.pullChaptersFromNetwork("/manga2")).thenReturn(Observable.<List<Chapter>>error(new Exception()));
when(source.pullChaptersFromNetwork("/manga3")).thenReturn(Observable.just(chapters3));
when(source.fetchChapterList(favManga.get(0))).thenReturn(Observable.just(chapters));
when(source.fetchChapterList(favManga.get(1))).thenReturn(Observable.<List<Chapter>>error(new Exception()));
when(source.fetchChapterList(favManga.get(2))).thenReturn(Observable.just(chapters3));
service.updateMangaList(service.getMangaToUpdate(null)).subscribe();