Search in sources :

Example 11 with Config

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

the class ConfigTests method testFacebookEmptyConfig.

@Test
public void testFacebookEmptyConfig() {
    JsonObject fbConfig = new JsonObject();
    JsonObject configBase = new JsonObject();
    configBase.add(FACEBOOK, fbConfig);
    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 12 with Config

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

the class ConfigTests method testEnrollmentInvalidType.

@Test(expected = IllegalArgumentException.class)
public void testEnrollmentInvalidType() {
    JsonObject configBase = new JsonObject();
    JsonObject enrollmentConfig = new JsonObject();
    enrollmentConfig.add(TYPE, new JsonPrimitive("invalid type"));
    configBase.add(COURSE_ENROLLMENT, enrollmentConfig);
    Config config = new Config(configBase);
    assertFalse(config.getCourseDiscoveryConfig().isCourseDiscoveryEnabled());
}
Also used : JsonPrimitive(com.google.gson.JsonPrimitive) Config(org.edx.mobile.util.Config) JsonObject(com.google.gson.JsonObject) Test(org.junit.Test)

Example 13 with Config

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

the class ConfigTests method testFabricKitsConfig.

@Test
public void testFabricKitsConfig() {
    JsonObject fabricKits = new JsonObject();
    fabricKits.add(CRASHLYTICS, new JsonPrimitive(true));
    fabricKits.add(ANSWERS, new JsonPrimitive(true));
    JsonObject fabricConfig = new JsonObject();
    fabricConfig.add(KITS, fabricKits);
    JsonObject configBase = new JsonObject();
    configBase.add(FABRIC, fabricConfig);
    Config config = new Config(configBase);
    assertTrue(config.getFabricConfig().getKitsConfig().isAnswersEnabled());
    assertTrue(config.getFabricConfig().getKitsConfig().isCrashlyticsEnabled());
    assertTrue(config.getFabricConfig().getKitsConfig().hasEnabledKits());
    assertEquals(2, config.getFabricConfig().getKitsConfig().getEnabledKits().length);
}
Also used : JsonPrimitive(com.google.gson.JsonPrimitive) Config(org.edx.mobile.util.Config) JsonObject(com.google.gson.JsonObject) Test(org.junit.Test)

Example 14 with Config

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

the class ConfigTests method testGoogleConfig.

@Test
public void testGoogleConfig() {
    JsonObject googleConfig = new JsonObject();
    googleConfig.add(ENABLED, new JsonPrimitive(true));
    JsonObject configBase = new JsonObject();
    configBase.add(GOOGLE, googleConfig);
    Config config = new Config(configBase);
    assertTrue(config.getGoogleConfig().isEnabled());
}
Also used : JsonPrimitive(com.google.gson.JsonPrimitive) Config(org.edx.mobile.util.Config) JsonObject(com.google.gson.JsonObject) Test(org.junit.Test)

Example 15 with Config

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

the class ConfigTests method testNewRelicEmptyConfig.

@Test
public void testNewRelicEmptyConfig() {
    JsonObject fabricConfig = new JsonObject();
    JsonObject configBase = new JsonObject();
    configBase.add(NEW_RELIC, fabricConfig);
    Config config = new Config(configBase);
    assertFalse(config.getNewRelicConfig().isEnabled());
    assertNull(config.getNewRelicConfig().getNewRelicKey());
}
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