-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #153 from project-sunbird/report_viewer
Report viewer
- Loading branch information
Showing
4 changed files
with
125 additions
and
23 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
...rd_service_api_test/src/test/java/org/sunbird/integration/test/user/ReadUserTypeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package org.sunbird.integration.test.user; | ||
|
||
import com.consol.citrus.annotations.CitrusTest; | ||
import com.consol.citrus.testng.CitrusParameters; | ||
import org.springframework.http.HttpStatus; | ||
import org.sunbird.integration.test.common.BaseCitrusTestRunner; | ||
import org.testng.annotations.DataProvider; | ||
import org.testng.annotations.Test; | ||
|
||
public class ReadUserTypeTest extends BaseCitrusTestRunner { | ||
|
||
public static final String TEST_READ_USER_TYPE_FAILURE_WITHOUT_ACCESS_TOKEN = | ||
"testReadUserTypeFailureWithoutAccessToken"; | ||
|
||
public static final String TEST_READ_USER_TYPE_SUCCESS_WITH_ACCESS_TOKEN = | ||
"testReadUserTypeSuccessWithAccessToken"; | ||
|
||
public static final String TEMPLATE_DIR = "templates/user/type/read"; | ||
|
||
private String getReadUserTypeUrl() { | ||
return getLmsApiUriPath("/api/user/v1/type/list", "/v1/user/type/list"); | ||
} | ||
|
||
@DataProvider(name = "readUserTypeFailureDataProvider") | ||
public Object[][] readUserTypeFailureDataProvider() { | ||
|
||
return new Object[][] { | ||
new Object[] { | ||
TEST_READ_USER_TYPE_FAILURE_WITHOUT_ACCESS_TOKEN, false, HttpStatus.UNAUTHORIZED | ||
} | ||
}; | ||
} | ||
|
||
@DataProvider(name = "readUserTypeSuccessDataProvider") | ||
public Object[][] readUserTypeSuccessDataProvider() { | ||
return new Object[][] { | ||
new Object[] {TEST_READ_USER_TYPE_SUCCESS_WITH_ACCESS_TOKEN, true, HttpStatus.OK}, | ||
}; | ||
} | ||
|
||
@Test(dataProvider = "readUserTypeFailureDataProvider") | ||
@CitrusParameters({"testName", "isAuthRequired", "httpStatusCode"}) | ||
@CitrusTest | ||
public void testReadUserTypeFailure( | ||
String testName, boolean isAuthRequired, HttpStatus httpStatusCode) { | ||
getTestCase().setName(testName); | ||
getAuthToken(this, isAuthRequired); | ||
performGetTest( | ||
this, | ||
TEMPLATE_DIR, | ||
testName, | ||
getReadUserTypeUrl(), | ||
isAuthRequired, | ||
httpStatusCode, | ||
RESPONSE_JSON); | ||
} | ||
|
||
@Test(dataProvider = "readUserTypeSuccessDataProvider") | ||
@CitrusParameters({"testName", "isAuthRequired", "httpStatusCode"}) | ||
@CitrusTest | ||
public void testReadUserTypeSuccess( | ||
String testName, boolean isAuthRequired, HttpStatus httpStatusCode) { | ||
getTestCase().setName(testName); | ||
getAuthToken(this, isAuthRequired); | ||
performGetTest( | ||
this, | ||
TEMPLATE_DIR, | ||
testName, | ||
getReadUserTypeUrl(), | ||
isAuthRequired, | ||
httpStatusCode, | ||
RESPONSE_JSON); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...esources/templates/user/type/read/testReadUserTypeFailureWithoutAccessToken/response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"id": "api.user.type.list", | ||
"ver": "v1", | ||
"ts": "@ignore@", | ||
"params": { | ||
"resmsgid": null, | ||
"msgid": "@ignore@", | ||
"err": "UNAUTHORIZED_USER", | ||
"status": "SERVER_ERROR", | ||
"errmsg": "You are not authorized." | ||
}, | ||
"responseCode": "CLIENT_ERROR", | ||
"result": {} | ||
} |
25 changes: 25 additions & 0 deletions
25
...t/resources/templates/user/type/read/testReadUserTypeSuccessWithAccessToken/response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"id": "api.user.type.list", | ||
"ver": "v1", | ||
"ts": "@ignore@", | ||
"params": { | ||
"resmsgid": null, | ||
"msgid": "@ignore@", | ||
"err": null, | ||
"status": "success", | ||
"errmsg": null | ||
}, | ||
"responseCode": "OK", | ||
"result": { | ||
"response": [ | ||
{ | ||
"name": "TEACHER", | ||
"id": "TEACHER" | ||
}, | ||
{ | ||
"name": "OTHER", | ||
"id": "OTHER" | ||
} | ||
] | ||
} | ||
} |