Search in sources :

Example 21 with Config

use of org.edx.mobile.util.Config in project edx-app-android by edx.

the class ConfigTests method testZeroRatingNoConfig.

@Test
public void testZeroRatingNoConfig() {
    JsonObject configBase = new JsonObject();
    Config config = new Config(configBase);
    assertFalse(config.getZeroRatingConfig().isEnabled());
    assertEquals(config.getZeroRatingConfig().getCarriers().size(), 0);
}
Also used : Config(org.edx.mobile.util.Config) JsonObject(com.google.gson.JsonObject) Test(org.junit.Test)

Example 22 with Config

use of org.edx.mobile.util.Config in project edx-app-android by edx.

the class LoginPresenterTest method testOnViewCreation_withGoogleFacebookEnabled_socialLoginButtonsVisible.

@Test
public void testOnViewCreation_withGoogleFacebookEnabled_socialLoginButtonsVisible() {
    when(config.getGoogleConfig()).thenReturn(new Config.GoogleConfig(true));
    when(config.getFacebookConfig()).thenReturn(new Config.FacebookConfig(false, "dummy app id"));
    startPresenter(new LoginPresenter(config, zeroRatedNetworkInfo));
    verify(view).setSocialLoginButtons(true, false);
}
Also used : LoginPresenter(org.edx.mobile.view.login.LoginPresenter) Config(org.edx.mobile.util.Config) PresenterTest(org.edx.mobile.test.PresenterTest) Test(org.junit.Test)

Example 23 with Config

use of org.edx.mobile.util.Config in project edx-app-android by edx.

the class LoginPresenterTest method testOnViewCreation_withGoogleLoginDisabled_googleButtonNotVisible.

@Test
public void testOnViewCreation_withGoogleLoginDisabled_googleButtonNotVisible() {
    when(config.getGoogleConfig()).thenReturn(new Config.GoogleConfig(false));
    when(config.getFacebookConfig()).thenReturn(new Config.FacebookConfig(false, "dummy app id"));
    startPresenter(new LoginPresenter(config, zeroRatedNetworkInfo));
    verify(view).setSocialLoginButtons(false, false);
}
Also used : LoginPresenter(org.edx.mobile.view.login.LoginPresenter) Config(org.edx.mobile.util.Config) PresenterTest(org.edx.mobile.test.PresenterTest) Test(org.junit.Test)

Example 24 with Config

use of org.edx.mobile.util.Config in project edx-app-android by edx.

the class LoginPresenterTest method testOnViewCreation_withZeroRatedNetwork_socialLoginButtonsNotVisible.

@Test
public void testOnViewCreation_withZeroRatedNetwork_socialLoginButtonsNotVisible() {
    when(zeroRatedNetworkInfo.isOnZeroRatedNetwork()).thenReturn(true);
    when(config.getGoogleConfig()).thenReturn(new Config.GoogleConfig(true));
    when(config.getFacebookConfig()).thenReturn(new Config.FacebookConfig(true, "dummy app id"));
    startPresenter(new LoginPresenter(config, zeroRatedNetworkInfo));
    verify(view).setSocialLoginButtons(false, false);
}
Also used : LoginPresenter(org.edx.mobile.view.login.LoginPresenter) Config(org.edx.mobile.util.Config) PresenterTest(org.edx.mobile.test.PresenterTest) Test(org.junit.Test)

Example 25 with Config

use of org.edx.mobile.util.Config in project edx-app-android by edx.

the class LoginPresenterTest method testOnViewCreation_withFacebookLoginDisabled_facebookButtonNotVisible.

@Test
public void testOnViewCreation_withFacebookLoginDisabled_facebookButtonNotVisible() {
    when(config.getGoogleConfig()).thenReturn(new Config.GoogleConfig(false));
    when(config.getFacebookConfig()).thenReturn(new Config.FacebookConfig(true, "dummy app id"));
    startPresenter(new LoginPresenter(config, zeroRatedNetworkInfo));
    verify(view).setSocialLoginButtons(false, true);
}
Also used : LoginPresenter(org.edx.mobile.view.login.LoginPresenter) Config(org.edx.mobile.util.Config) PresenterTest(org.edx.mobile.test.PresenterTest) Test(org.junit.Test)

Aggregations

Config (org.edx.mobile.util.Config)33 Test (org.junit.Test)28 JsonObject (com.google.gson.JsonObject)24 JsonPrimitive (com.google.gson.JsonPrimitive)10 PresenterTest (org.edx.mobile.test.PresenterTest)4 LoginPresenter (org.edx.mobile.view.login.LoginPresenter)4 NonNull (android.support.annotation.NonNull)2 View (android.view.View)2 BuildConfig (org.edx.mobile.BuildConfig)2 Resources (android.content.res.Resources)1 ActionBar (android.support.v7.app.ActionBar)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 SearchView (android.support.v7.widget.SearchView)1 MenuItem (android.view.MenuItem)1 OnClickListener (android.view.View.OnClickListener)1 Gson (com.google.gson.Gson)1 GsonBuilder (com.google.gson.GsonBuilder)1 JsonArray (com.google.gson.JsonArray)1 EventBus (de.greenrobot.event.EventBus)1 ArrayList (java.util.ArrayList)1