Search in sources :

Example 1 with PageProperties

use of org.wikipedia.page.PageProperties in project apps-android-wikipedia by wikimedia.

the class DescriptionEditClientTest method testIsEditAllowedSuccess.

@Test
public void testIsEditAllowedSuccess() {
    WikiSite wiki = WikiSite.forLanguageCode("ru");
    PageProperties props = mock(PageProperties.class);
    when(props.getWikiBaseItem()).thenReturn("Q123");
    when(props.canEdit()).thenReturn(true);
    when(props.getDescriptionSource()).thenReturn("central");
    Page page = new Page(new PageTitle("Test", wiki, null, null, props), Collections.<Section>emptyList(), props);
    assertThat(DescriptionEditUtil.isEditAllowed(page), is(true));
}
Also used : PageProperties(org.wikipedia.page.PageProperties) PageTitle(org.wikipedia.page.PageTitle) Page(org.wikipedia.page.Page) WikiSite(org.wikipedia.dataclient.WikiSite) Test(org.junit.Test) MockRetrofitTest(org.wikipedia.test.MockRetrofitTest)

Example 2 with PageProperties

use of org.wikipedia.page.PageProperties in project apps-android-wikipedia by wikimedia.

the class DescriptionEditClientTest method testIsEditAllowedNoWikiBaseItem.

@Test
public void testIsEditAllowedNoWikiBaseItem() {
    WikiSite wiki = WikiSite.forLanguageCode("ru");
    PageProperties props = mock(PageProperties.class);
    when(props.getWikiBaseItem()).thenReturn(null);
    Page page = new Page(new PageTitle("Test", wiki, null, null, props), Collections.<Section>emptyList(), props);
    assertThat(DescriptionEditUtil.isEditAllowed(page), is(false));
}
Also used : PageProperties(org.wikipedia.page.PageProperties) PageTitle(org.wikipedia.page.PageTitle) Page(org.wikipedia.page.Page) WikiSite(org.wikipedia.dataclient.WikiSite) Test(org.junit.Test) MockRetrofitTest(org.wikipedia.test.MockRetrofitTest)

Example 3 with PageProperties

use of org.wikipedia.page.PageProperties in project apps-android-wikipedia by wikimedia.

the class ShareHandler method createFunnel.

private void createFunnel() {
    WikipediaApp app = WikipediaApp.getInstance();
    final Page page = fragment.getPage();
    final PageProperties pageProperties = page.getPageProperties();
    funnel = new ShareAFactFunnel(app, page.getTitle(), pageProperties.getPageId(), pageProperties.getRevisionId());
}
Also used : PageProperties(org.wikipedia.page.PageProperties) WikipediaApp(org.wikipedia.WikipediaApp) MwQueryPage(org.wikipedia.dataclient.mwapi.MwQueryPage) Page(org.wikipedia.page.Page) ShareAFactFunnel(org.wikipedia.analytics.ShareAFactFunnel)

Example 4 with PageProperties

use of org.wikipedia.page.PageProperties in project apps-android-wikipedia by wikimedia.

the class ParcelableTest method testPageProperties.

@Test
public void testPageProperties() throws Throwable {
    WikiSite wiki = WikiSite.forLanguageCode("en");
    PageTitle title = new PageTitle("Talk", "India", wiki);
    PageProperties props = new PageProperties(title, false);
    TestParcelUtil.test(props);
}
Also used : PageProperties(org.wikipedia.page.PageProperties) PageTitle(org.wikipedia.page.PageTitle) WikiSite(org.wikipedia.dataclient.WikiSite) Test(org.junit.Test)

Aggregations

PageProperties (org.wikipedia.page.PageProperties)4 Test (org.junit.Test)3 WikiSite (org.wikipedia.dataclient.WikiSite)3 Page (org.wikipedia.page.Page)3 PageTitle (org.wikipedia.page.PageTitle)3 MockRetrofitTest (org.wikipedia.test.MockRetrofitTest)2 WikipediaApp (org.wikipedia.WikipediaApp)1 ShareAFactFunnel (org.wikipedia.analytics.ShareAFactFunnel)1 MwQueryPage (org.wikipedia.dataclient.mwapi.MwQueryPage)1