Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
GLPI
java-library-glpi
Commits
cdf9cd2c
Unverified
Commit
cdf9cd2c
authored
Oct 24, 2017
by
Rafa Hernandez
Browse files
test(glpi): add initial init session by credentials test
parent
d98fd039
Changes
1
Hide whitespace changes
Inline
Side-by-side
glpi/src/androidTest/java/org/flyve/glpi/GLPITest.java
View file @
cdf9cd2c
...
...
@@ -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
);
}
});
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment