()
| 2548 | } |
| 2549 | |
| 2550 | @Test |
| 2551 | public void testGetProgress() |
| 2552 | { |
| 2553 | String userName = new String("progressUser1"); |
| 2554 | String className = new String("progressClass1"); |
| 2555 | String otherUserName = new String("progressUser2"); |
| 2556 | String otherClassName = new String("progressClass2"); |
| 2557 | String anotherUserName = new String("progressClass3"); |
| 2558 | String classId = new String(); |
| 2559 | String classId2 = new String(); |
| 2560 | String insecureDirectObjectRefLesson = "0dbea4cb5811fff0527184f99bd5034ca9286f11"; //Direct Object Reference Module |
| 2561 | try |
| 2562 | { |
| 2563 | try |
| 2564 | { |
| 2565 | classId = findCreateClassId(className); |
| 2566 | classId2 = findCreateClassId(otherClassName); |
| 2567 | } |
| 2568 | catch(Exception e) |
| 2569 | { |
| 2570 | log.fatal("Could not Find or Create Class : " + e.toString()); |
| 2571 | fail("Could not Create or Find Classes"); |
| 2572 | } |
| 2573 | if(verifyTestUser(applicationRoot, userName, userName, classId) && |
| 2574 | verifyTestUser(applicationRoot, anotherUserName, anotherUserName, classId) && |
| 2575 | verifyTestUser(applicationRoot, otherUserName, otherUserName, classId2)) |
| 2576 | { |
| 2577 | String userId = Getter.getUserIdFromName(applicationRoot, userName); |
| 2578 | String otherUserId = Getter.getUserIdFromName(applicationRoot, otherUserName); |
| 2579 | //Open all Modules First |
| 2580 | if(Setter.openAllModules(applicationRoot)) |
| 2581 | { |
| 2582 | //Simulate user Opening Level |
| 2583 | if(Getter.getModuleAddress(applicationRoot, insecureDirectObjectRefLesson, userId).isEmpty()) |
| 2584 | { |
| 2585 | fail("Could not Simulate Opening Level for User 1"); |
| 2586 | } |
| 2587 | else if(Getter.getModuleAddress(applicationRoot, insecureDirectObjectRefLesson, otherUserId).isEmpty()) |
| 2588 | { |
| 2589 | fail("Could not Simulate Opening Level for User 1"); |
| 2590 | } |
| 2591 | else |
| 2592 | { |
| 2593 | String markLevelCompleteTest = Setter.updatePlayerResult(applicationRoot, insecureDirectObjectRefLesson, userId, "Feedback is Disabled", 1, 1, 1); |
| 2594 | if(markLevelCompleteTest != null) |
| 2595 | markLevelCompleteTest = Setter.updatePlayerResult(applicationRoot, insecureDirectObjectRefLesson, otherUserId, "Feedback is Disabled", 1, 1, 1); |
| 2596 | else |
| 2597 | fail("Could Not Mark Level as complete by User 1"); |
| 2598 | if (markLevelCompleteTest != null) |
| 2599 | { |
| 2600 | String classProgress = Getter.getProgress(applicationRoot, classId); |
| 2601 | if(classProgress.indexOf(otherClassName) > 0) |
| 2602 | { |
| 2603 | fail("User from wrong class is listed in getProgress response"); |
| 2604 | } |
| 2605 | else if(classProgress.indexOf(userName) == -1) |
| 2606 | { |
| 2607 | fail("Could not find user from class in getProgress response"); |
nothing calls this directly
no test coverage detected