Search in sources :

Example 6 with Config

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

the class ConfigTests method testFacebookNoConfig.

@Test
public void testFacebookNoConfig() {
    JsonObject configBase = new JsonObject();
    Config config = new Config(configBase);
    assertFalse(config.getFacebookConfig().isEnabled());
    assertNull(config.getFacebookConfig().getFacebookAppId());
}
Also used : Config(org.edx.mobile.util.Config) JsonObject(com.google.gson.JsonObject) Test(org.junit.Test)

Example 7 with Config

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

the class ConfigTests method testZeroRatingEmptyConfig.

@Test
public void testZeroRatingEmptyConfig() {
    JsonObject configBase = new JsonObject();
    JsonObject socialConfig = new JsonObject();
    configBase.add(ZERO_RATING, socialConfig);
    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 8 with Config

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

the class ConfigTests method testEnrollmentEmptyConfig.

@Test
public void testEnrollmentEmptyConfig() {
    JsonObject configBase = new JsonObject();
    JsonObject enrollmentConfig = new JsonObject();
    configBase.add(COURSE_ENROLLMENT, enrollmentConfig);
    Config config = new Config(configBase);
    assertFalse(config.getCourseDiscoveryConfig().isCourseDiscoveryEnabled());
    assertFalse(config.getCourseDiscoveryConfig().isWebviewCourseDiscoveryEnabled());
    assertNull(config.getCourseDiscoveryConfig().getCourseSearchUrl());
    assertNull(config.getCourseDiscoveryConfig().getCourseInfoUrlTemplate());
}
Also used : Config(org.edx.mobile.util.Config) JsonObject(com.google.gson.JsonObject) Test(org.junit.Test)

Example 9 with Config

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

the class ConfigTests method testEnrollmentConfig_withExploreSubjectsEnabled.

@Test
public void testEnrollmentConfig_withExploreSubjectsEnabled() {
    JsonObject configBase = new JsonObject();
    JsonObject enrollmentConfig = new JsonObject();
    JsonObject webviewConfig = new JsonObject();
    enrollmentConfig.add(TYPE, new JsonPrimitive("WEBVIEW"));
    webviewConfig.add(COURSE_SEARCH_URL, new JsonPrimitive("fake-url"));
    webviewConfig.add(EXPLORE_SUBJECTS_URL, new JsonPrimitive("explore-subjects-url"));
    webviewConfig.add(COURSE_INFO_URL_TEMPLATE, new JsonPrimitive("fake-url-template"));
    enrollmentConfig.add("WEBVIEW", webviewConfig);
    configBase.add(COURSE_ENROLLMENT, enrollmentConfig);
    Config config = new Config(configBase);
    assertTrue(config.getCourseDiscoveryConfig().isCourseDiscoveryEnabled());
    assertTrue(config.getCourseDiscoveryConfig().isWebviewCourseDiscoveryEnabled());
    assertEquals(config.getCourseDiscoveryConfig().getCourseSearchUrl(), "fake-url");
    assertEquals(config.getCourseDiscoveryConfig().getCourseInfoUrlTemplate(), "fake-url-template");
}
Also used : JsonPrimitive(com.google.gson.JsonPrimitive) Config(org.edx.mobile.util.Config) JsonObject(com.google.gson.JsonObject) Test(org.junit.Test)

Example 10 with Config

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

the class ConfigTests method testGoogleNoConfig.

@Test
public void testGoogleNoConfig() {
    JsonObject configBase = new JsonObject();
    Config config = new Config(configBase);
    assertFalse(config.getGoogleConfig().isEnabled());
}
Also used : Config(org.edx.mobile.util.Config) JsonObject(com.google.gson.JsonObject) 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