Unverified Commit cdf9cd2c authored by Rafa Hernandez's avatar Rafa Hernandez
Browse files

test(glpi): add initial init session by credentials test

parent d98fd039
......@@ -4,6 +4,8 @@ import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.flyve.glpi.response.InitSession;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
......@@ -15,12 +17,28 @@ import static org.junit.Assert.*;
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
public class GLPITest {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
String sessionToken = "";
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
public void initSessionTest() throws Exception {
GLPI glpi = new GLPI(appContext, "https://dev.flyve.org/glpi/apirest.php/");
glpi.initSessionByCredentials("rafaelje@gmail.com", "12345678", new GLPI.InitSessionCallback() {
@Override
public void onResponse(InitSession response) {
sessionToken = response.getSessionToken();
assertNotEquals("", sessionToken);
}
assertEquals("org.flyve.glpi.test", appContext.getPackageName());
@Override
public void onFailure(String errorMessage) {
Assert.assertTrue(false);
}
});
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment