Search in sources :

Example 26 with Config

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

the class ConfigTests method testFacebookConfig.

@Test
public void testFacebookConfig() {
    String appId = "fake-app-id";
    JsonObject fbConfig = new JsonObject();
    fbConfig.add(ENABLED, new JsonPrimitive(true));
    fbConfig.add(FACEBOOK_APP_ID, new JsonPrimitive(appId));
    JsonObject configBase = new JsonObject();
    configBase.add(FACEBOOK, fbConfig);
    Config config = new Config(configBase);
    assertTrue(config.getFacebookConfig().isEnabled());
    assertEquals(appId, config.getFacebookConfig().getFacebookAppId());
}
Also used : JsonPrimitive(com.google.gson.JsonPrimitive) Config(org.edx.mobile.util.Config) JsonObject(com.google.gson.JsonObject) Test(org.junit.Test)

Example 27 with Config

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

the class ConfigTests method testFabricNoConfig.

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

Example 28 with Config

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

the class ConfigTests method testNewRelicConfig.

@Test
public void testNewRelicConfig() {
    String key = "fake-key";
    JsonObject newRelicConfig = new JsonObject();
    newRelicConfig.add(ENABLED, new JsonPrimitive(true));
    newRelicConfig.add(NEW_RELIC_KEY, new JsonPrimitive(key));
    JsonObject configBase = new JsonObject();
    configBase.add(NEW_RELIC, newRelicConfig);
    Config config = new Config(configBase);
    assertTrue(config.getNewRelicConfig().isEnabled());
    assertEquals(key, config.getNewRelicConfig().getNewRelicKey());
}
Also used : JsonPrimitive(com.google.gson.JsonPrimitive) Config(org.edx.mobile.util.Config) JsonObject(com.google.gson.JsonObject) Test(org.junit.Test)

Example 29 with Config

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

the class ConfigTests method testFabricEmptyConfig.

@Test
public void testFabricEmptyConfig() {
    JsonObject fabricConfig = new JsonObject();
    JsonObject configBase = new JsonObject();
    configBase.add(FABRIC, fabricConfig);
    Config config = new Config(configBase);
    assertFalse(config.getFabricConfig().isEnabled());
    assertNull(config.getFabricConfig().getFabricKey());
    assertNull(config.getFabricConfig().getFabricBuildSecret());
}
Also used : Config(org.edx.mobile.util.Config) JsonObject(com.google.gson.JsonObject) Test(org.junit.Test)

Example 30 with Config

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

the class ConfigTests method testNewRelicNoConfig.

@Test
public void testNewRelicNoConfig() {
    JsonObject configBase = new JsonObject();
    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