Search in sources :

Example 1 with Page

use of org.wikipedia.page.Page 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) Page(org.wikipedia.page.Page) ShareAFactFunnel(org.wikipedia.analytics.ShareAFactFunnel)

Example 2 with Page

use of org.wikipedia.page.Page 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(DescriptionEditClient.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) MockWebServerTest(org.wikipedia.test.MockWebServerTest)

Example 3 with Page

use of org.wikipedia.page.Page 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);
    Page page = new Page(new PageTitle("Test", wiki, null, null, props), Collections.<Section>emptyList(), props);
    assertThat(DescriptionEditClient.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) MockWebServerTest(org.wikipedia.test.MockWebServerTest)

Aggregations

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