()
| 1848 | } |
| 1849 | |
| 1850 | @Test |
| 1851 | public void testGetLessons() |
| 1852 | { |
| 1853 | String userName = new String("getLessonsUser"); |
| 1854 | String inscureDirectObjectLesson = "0dbea4cb5811fff0527184f99bd5034ca9286f11"; |
| 1855 | String poorDataValidationLesson = "b9d82aa7b46ddaddb6acfe470452a8362136a31e"; |
| 1856 | try |
| 1857 | { |
| 1858 | if(verifyTestUser(applicationRoot, userName, userName)) |
| 1859 | { |
| 1860 | String userId = Getter.getUserIdFromName(applicationRoot, userName); |
| 1861 | //Open all Modules First |
| 1862 | if(Setter.openAllModules(applicationRoot)) |
| 1863 | { |
| 1864 | //Simulate user Opening Level |
| 1865 | if(!Getter.getModuleAddress(applicationRoot, inscureDirectObjectLesson, userId).isEmpty()) |
| 1866 | { |
| 1867 | String markLevelCompleteTest = Setter.updatePlayerResult(applicationRoot, inscureDirectObjectLesson, userId, "Feedback is Disabled", 1, 1, 1); |
| 1868 | if (markLevelCompleteTest != null) |
| 1869 | { |
| 1870 | String lessonsMenu = Getter.getLessons(applicationRoot, userId, locale); |
| 1871 | if(lessonsMenu.indexOf("class='lesson'") > -1) //Menu Should include this at least once |
| 1872 | { |
| 1873 | if(lessonsMenu.indexOf(inscureDirectObjectLesson) > -1) //This module should be in the response |
| 1874 | { |
| 1875 | if(lessonsMenu.indexOf("<img src='css/images/completed.png'/><a class='lesson' id='"+inscureDirectObjectLesson) > -1) //This module should be returned as completed |
| 1876 | { |
| 1877 | if(lessonsMenu.indexOf("<img src='css/images/uncompleted.png'/><a class='lesson' id='"+poorDataValidationLesson) > -1) |
| 1878 | { |
| 1879 | if(lessonsMenu.indexOf("Insecure Direct Object References") > -1) //English string should exist in output based on the submitted locale |
| 1880 | { |
| 1881 | log.debug("PASS: GetLessons Menu Appears to have Rendered correctly with the Preconditions of this test"); |
| 1882 | return; |
| 1883 | } |
| 1884 | else |
| 1885 | { |
| 1886 | log.fatal("Could not find i18n English String in lessons Menu: " + lessonsMenu); |
| 1887 | fail("Could not Detect i18n Locale Strings In Lessons Menu"); |
| 1888 | } |
| 1889 | } |
| 1890 | else |
| 1891 | { |
| 1892 | log.fatal("Could not detect Uncompleted Icon beside Poor Data Validation Lesson: " + lessonsMenu); |
| 1893 | fail("Uncompleted Module did not have Uncopmleted Symbol"); |
| 1894 | } |
| 1895 | } |
| 1896 | else |
| 1897 | { |
| 1898 | log.fatal("Could not detect completed Icon beside Insecure Direct Object Reference Lesson"); |
| 1899 | log.error("Could not find : <img src='css/images/completed.png'/><a class='lesson' id='"+inscureDirectObjectLesson + " in " + lessonsMenu); |
| 1900 | fail("Completed Module Did not Have Completed Symbol"); |
| 1901 | } |
| 1902 | } |
| 1903 | else |
| 1904 | { |
| 1905 | log.fatal("Could not find Insecure Direct Object References ModuleID in: " + lessonsMenu); |
| 1906 | fail("Could not find Insecure Direct Object References ModuleID in Response"); |
| 1907 | } |
nothing calls this directly
no test coverage detected