Java Code Examples for play.test.Helpers#fakeRequest()
The following examples show how to use
play.test.Helpers#fakeRequest() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SitemapControllerTest.java From play-sitemap-module.edulify.com with Apache License 2.0 | 5 votes |
@Test @SuppressWarnings("rawtypes") public void should_return_not_found_if_sitemap_file_does_not_exists() { Call action = routes.Sitemaps.sitemap("-fake"); Http.RequestBuilder request = Helpers.fakeRequest(action); Result result = Helpers.route(request); Assertions.assertThat(result.status()).isEqualTo(Helpers.NOT_FOUND); }
Example 2
Source File: SitemapControllerTest.java From play-sitemap-module.edulify.com with Apache License 2.0 | 5 votes |
@Test @SuppressWarnings("rawtypes") public void should_return_sitemap_file_when_it_does_exists() { Call action = routes.Sitemaps.sitemap("-blog"); Http.RequestBuilder request = Helpers.fakeRequest(action); Result result = Helpers.route(request); Assertions.assertThat(result.status()).isEqualTo(Helpers.OK); }
Example 3
Source File: SitemapControllerTest.java From play-sitemap-module.edulify.com with Apache License 2.0 | 5 votes |
@Test @SuppressWarnings("rawtypes") public void should_return_sitemap_file_root() { Call action = routes.Sitemaps.sitemap(""); Http.RequestBuilder request = Helpers.fakeRequest(action); Result result = Helpers.route(request); Assertions.assertThat(result.status()).isEqualTo(Helpers.OK); }
Example 4
Source File: SitemapControllerTest.java From play-sitemap-module.edulify.com with Apache License 2.0 | 5 votes |
@Test @SuppressWarnings("rawtypes") public void should_return_sitemap_file_index() { Call action = routes.Sitemaps.sitemap("_index"); Http.RequestBuilder request = Helpers.fakeRequest(action); Result result = Helpers.route(request); Assertions.assertThat(result.status()).isEqualTo(Helpers.OK); }
Example 5
Source File: SitemapControllerTest.java From play-sitemap-module.edulify.com with Apache License 2.0 | 5 votes |
@Test @SuppressWarnings("rawtypes") public void should_handle_malicious_directory_transversing_attack() { Call action = routes.Sitemaps.sitemap("../conf/application.conf"); Http.RequestBuilder request = Helpers.fakeRequest(action); Result result = Helpers.route(request); Assertions.assertThat(result.status()).isEqualTo(Helpers.NOT_FOUND); }
Example 6
Source File: SitemapControllerTest.java From play-sitemap-module.edulify.com with Apache License 2.0 | 5 votes |
@Test @SuppressWarnings("rawtypes") public void should_return_not_found_when_given_path_is_a_directory() { Call action = routes.Sitemaps.sitemap("javascripts"); Http.RequestBuilder request = Helpers.fakeRequest(action); Result result = Helpers.route(request); Assertions.assertThat(result.status()).isEqualTo(Helpers.NOT_FOUND); }