# See the License for the specific language governing permissions and
# limitations under the License.
-module test_example_angular is test_suite
+module test_example_angular is test
import pop_tests
import example_angular
class TestExampleAngular
super TestPopcorn
+ test
redef fun client_test do
system "curl -s {host}:{port}/counter"
system "curl -s {host}:{port}/not_found" # handled by angular controller
end
- fun test_example_angular do
+ fun test_example_angular is test do
var app = new App
app.use("/counter", new CounterAPI)
app.use("/*", new StaticHandler(test_path / "../www/", "index.html"))
# See the License for the specific language governing permissions and
# limitations under the License.
-module test_example_post_handler is test_suite
+module test_example_post_handler is test
import pop_tests
import example_post_handler
class TestExamplePostHandler
super TestPopcorn
+ test
redef fun client_test do
system "curl -s {host}:{port}/ -X POST"
system "curl -s {host}:{port}/"
end
- fun test_example_post_handler do
+ fun test_example_post_handler is test do
var app = new App
app.use("/", new PostHandler)
run_test(app)
# See the License for the specific language governing permissions and
# limitations under the License.
-module test_example_query_string is test_suite
+module test_example_query_string is test
import pop_tests
import example_query_string
class TestExampleQueryString
super TestPopcorn
+ test
redef fun client_test do
system "curl -s {host}:{port}/"
system "curl -s {host}:{port}/?items=10\\&order=asc"
end
- fun test_example_query_string do
+ fun test_example_query_string is test do
var app = new App
app.use("/", new QueryStringHandler)
run_test(app)
# See the License for the specific language governing permissions and
# limitations under the License.
-module test_example_hello is test_suite
+module test_example_hello is test
import pop_tests
import example_hello
class TestExampleHello
super TestPopcorn
+ test
redef fun client_test do
system "curl -s {host}:{port}"
system "curl -s {host}:{port}/not_found/not_found"
end
- fun test_example_hello do
+ fun test_example_hello is test do
var app = new App
app.use("/", new HelloHandler)
run_test(app)
# See the License for the specific language governing permissions and
# limitations under the License.
-module test_example_advanced_logger is test_suite
+module test_example_advanced_logger is test
import pop_tests
import example_advanced_logger
class TestExampleAdvancedLogger
super TestPopcorn
+ test
redef fun client_test do
system "curl -s {host}:{port}/"
system "curl -s {host}:{port}/about"
end
- fun test_example_advanced_logger do
+ fun test_example_advanced_logger is test do
var app = new App
app.use_before("/*", new RequestTimeHandler)
app.use("/", new AnotherHandler)
# See the License for the specific language governing permissions and
# limitations under the License.
-module test_example_html_error_handler is test_suite
+module test_example_html_error_handler is test
import pop_tests
import example_html_error_handler
class TestExampleHtmlErrorHandler
super TestPopcorn
+ test
redef fun client_test do
system "curl -s {host}:{port}/"
system "curl -s {host}:{port}/about"
end
- fun test_example_html_error_handler do
+ fun test_example_html_error_handler is test do
var app = new App
app.use("/*", new HtmlErrorHandler)
run_test(app)
# See the License for the specific language governing permissions and
# limitations under the License.
-module test_example_simple_error_handler is test_suite
+module test_example_simple_error_handler is test
import pop_tests
import example_simple_error_handler
class TestExampleSimpleErrorHandler
super TestPopcorn
+ test
redef fun client_test do
system "curl -s {host}:{port}/"
system "curl -s {host}:{port}/about"
end
- fun test_example_simple_error_handler do
+ fun test_example_simple_error_handler is test do
var app = new App
app.use("/", new SomeHandler)
app.use("/*", new SimpleErrorHandler)
# See the License for the specific language governing permissions and
# limitations under the License.
-module test_example_simple_logger is test_suite
+module test_example_simple_logger is test
import pop_tests
import example_simple_logger
class TestExampleSimpleLogger
super TestPopcorn
+ test
redef fun client_test do
system "curl -s {host}:{port}/"
system "curl -s {host}:{port}/about"
end
- fun test_example_simple_logger do
+ fun test_example_simple_logger is test do
var app = new App
app.use_before("/*", new SimpleLoggerHandler)
app.use("/", new MyOtherHandler)
# See the License for the specific language governing permissions and
# limitations under the License.
-module test_example_glob_route is test_suite
+module test_example_glob_route is test
import pop_tests
import example_glob_route
class TestExampleGlobRoute
super TestPopcorn
+ test
redef fun client_test do
system "curl -s {host}:{port}/user/Morriar/item/10"
system "curl -s {host}:{port}/not_found/not_found"
end
- fun test_example_glob_route do
+ fun test_example_glob_route is test do
var app = new App
app.use("/user/:user/item/:item/*", new UserItem)
run_test(app)
# See the License for the specific language governing permissions and
# limitations under the License.
-module test_example_param_route is test_suite
+module test_example_param_route is test
import pop_tests
import example_param_route
class TestExampleParamRoute
super TestPopcorn
+ test
redef fun client_test do
system "curl -s {host}:{port}/Morriar"
system "curl -s {host}:{port}/not_found/not_found"
end
- fun test_example_param_route do
+ fun test_example_param_route is test do
var app = new App
app.use("/:user", new UserHome)
run_test(app)
# See the License for the specific language governing permissions and
# limitations under the License.
-module test_example_router is test_suite
+module test_example_router is test
import pop_tests
import example_router
class TestExampleRouter
super TestPopcorn
+ test
redef fun client_test do
system "curl -s {host}:{port}"
system "curl -s {host}:{port}/products/not_found"
end
- fun test_example_router do
+ fun test_example_router is test do
var user_router = new Router
user_router.use("/*", new UserLogger)
user_router.use("/", new UserHomepage)
# See the License for the specific language governing permissions and
# limitations under the License.
-module test_example_session is test_suite
+module test_example_session is test
import pop_tests
import example_session
class TestExampleSession
super TestPopcorn
+ test
redef fun client_test do
system "curl -s {host}:{port}/"
system "curl -s {host}:{port}/products/not_found"
end
- fun test_example_session do
+ fun test_example_session is test do
var app = new App
app.use("/*", new SessionInit)
app.use("/", new AppLogin)
# See the License for the specific language governing permissions and
# limitations under the License.
-module test_example_static is test_suite
+module test_example_static is test
import pop_tests
import example_static
class TestExampleStatic
super TestPopcorn
+ test
redef fun client_test do
system "curl -s {host}:{port}/css/style.css"
system "curl -s {host}:{port}/not_found.nit"
end
- fun test_example_static do
+ fun test_example_static is test do
var app = new App
app.use("/", new StaticHandler(test_path / "../public/"))
run_test(app)
# See the License for the specific language governing permissions and
# limitations under the License.
-module test_example_static_default is test_suite
+module test_example_static_default is test
import pop_tests
import example_static_default
class TestExampleStaticDefault
super TestPopcorn
+ test
redef fun client_test do
system "curl -s {host}:{port}/css/style.css"
system "curl -s {host}:{port}/not_found.nit"
end
- fun test_example_static_default do
+ fun test_example_static_default is test do
var app = new App
app.use("/", new StaticHandler(test_path / "../public/", "default.html"))
run_test(app)
# See the License for the specific language governing permissions and
# limitations under the License.
-module test_example_static_multiple is test_suite
+module test_example_static_multiple is test
import pop_tests
import example_static_multiple
class TestExampleStaticMultiple
super TestPopcorn
+ test
redef fun client_test do
system "curl -s {host}:{port}/css/style.css"
system "curl -s {host}:{port}/not_found.nit"
end
- fun test_example_static_multiple do
+ fun test_example_static_multiple is test do
var app = new App
app.use("/", new StaticHandler(test_path / "../public/"))
app.use("/", new StaticHandler(test_path / "../files/"))
# See the License for the specific language governing permissions and
# limitations under the License.
-module test_example_templates is test_suite
+module test_example_templates is test
import pop_tests
intrude import example_templates
class TestExampleTemplate
super TestPopcorn
+ test
redef fun client_test do
system "curl -s {host}:{port}/"
end
- fun test_example_template do
+ fun test_example_template is test do
var app = new App
app.use("/", new MyTemplateHandler)
run_test(app)
class TestExampleTemplateString
super TestPopcorn
+ test
redef fun client_test do
system "curl -s {host}:{port}/"
end
- fun test_example_template_string do
+ fun test_example_template_string is test do
var app = new App
app.use("/", new MyTemplateStringHandler)
run_test(app)
class TestExampleTemplateFile
super TestPopcorn
+ test
redef fun client_test do
system "curl -s {host}:{port}/"
end
- fun test_example_template_file do
+ fun test_example_template_file is test do
var app = new App
var handler = new MyTemplateFileHandler
handler.tpl_file = test_path / "../example_template.tpl"
class TestExampleTemplatePug
super TestPopcorn
+ test
redef fun client_test do
system "curl -s {host}:{port}/"
end
- fun test_example_template_pug do
+ fun test_example_template_pug is test do
var app = new App
app.use("/", new MyTemplatePugHandler)
run_test(app)
class TestExampleTemplatePugFile
super TestPopcorn
+ test
redef fun client_test do
system "curl -s {host}:{port}/"
end
- fun test_example_template_pug_file do
+ fun test_example_template_pug_file is test do
var app = new App
var handler = new MyTemplatePugFileHandler
handler.pug_file = test_path / "../example_template.pug"
# Here we use `curl` to access some URI on the app.
#
# ~~~nitish
-# module test_example_hello is test_suite
+# module test_example_hello is test
#
# import pop_tests
# import example_hello
#
# class TestExampleHello
# super TestPopcorn
+# test
#
-# fun test_example_hello do
+# fun example_hello is test do
# var app = new App
# app.use("/", new HelloHandler)
# run_test(app)
# See `examples/hello_world` for the complete example.
module pop_tests
-import test_suite
import popcorn
import pthreads
# TestSuite for Popcorn blackbox testing.
class TestPopcorn
- super TestSuite
# Host used to run App.
var host: String = test_host
# See the License for the specific language governing permissions and
# limitations under the License.
-module test_pop_routes is test_suite
+module test_pop_routes is test
import pop_routes
-import test_suite
class TestAppRoute
- super TestSuite
+ test
- fun test_root_match_only_one_uri do
+ fun test_root_match_only_one_uri is test do
var r = new AppRoute("/")
assert r.match("")
assert r.match("/")
assert not r.match("/user")
end
- fun test_strict_route_match_only_one_uri do
+ fun test_strict_route_match_only_one_uri is test do
var r = new AppRoute("/user")
assert not r.match("/")
assert r.match("/user")
end
class TestAppParamRoute
- super TestSuite
+ test
- fun test_param_route_match_good_uri_params_1 do
+ fun test_param_route_match_good_uri_params_1 is test do
var r = new AppParamRoute("/:id")
assert not r.match("/")
assert r.match("/user")
assert not r.match("/user/10")
end
- fun test_param_route_match_good_uri_params_2 do
+ fun test_param_route_match_good_uri_params_2 is test do
var r = new AppParamRoute("/user/:id")
assert not r.match("/")
assert not r.match("/user")
assert not r.match("/user/10/profile")
end
- fun test_param_route_match_good_uri_params_3 do
+ fun test_param_route_match_good_uri_params_3 is test do
var r = new AppParamRoute("/user/:id/profile")
assert not r.match("/")
assert not r.match("/user")
assert not r.match("/user/10/foo")
end
- fun test_param_route_match_good_uri_params_4 do
+ fun test_param_route_match_good_uri_params_4 is test do
var r = new AppParamRoute("/:id/:foo")
assert not r.match("/")
assert not r.match("/user")
assert not r.match("/user/10/10")
end
- fun test_param_route_match_good_uri_params_5 do
+ fun test_param_route_match_good_uri_params_5 is test do
var r = new AppParamRoute("/user/:id/:foo")
assert not r.match("/")
assert not r.match("/user")
assert not r.match("/user/10/10/profile")
end
- fun test_param_route_match_good_uri_params_6 do
+ fun test_param_route_match_good_uri_params_6 is test do
var r = new AppParamRoute("/user/:id/settings/:foo")
assert not r.match("/")
assert not r.match("/user")
end
class TestRouteMatching
- super TestSuite
+ test
- fun test_glob_route_match_good_uri_prefix1 do
+ fun test_glob_route_match_good_uri_prefix1 is test do
var r = new AppGlobRoute("/*")
assert r.match("/")
assert r.match("/user")
assert r.match("/user/10")
end
- fun test_glob_route_match_good_uri_prefix2 do
+ fun test_glob_route_match_good_uri_prefix2 is test do
var r = new AppGlobRoute("/user/*")
assert not r.match("/")
assert r.match("/user")
assert r.match("/user/10")
end
- fun test_glob_route_match_good_uri_prefix3 do
+ fun test_glob_route_match_good_uri_prefix3 is test do
var r = new AppGlobRoute("/user*")
assert not r.match("/")
assert r.match("/user")
assert r.match("/user/10")
end
- fun test_glob_route_work_with_parameters_1 do
+ fun test_glob_route_work_with_parameters_1 is test do
var r = new AppGlobRoute("/:id/*")
assert not r.match("/")
assert r.match("/user")
assert r.match("/user/10/profile")
end
- fun test_glob_route_work_with_parameters_2 do
+ fun test_glob_route_work_with_parameters_2 is test do
var r = new AppGlobRoute("/:id*")
assert not r.match("/")
assert r.match("/user")
assert r.match("/user/10")
end
- fun test_glob_route_work_with_parameters_3 do
+ fun test_glob_route_work_with_parameters_3 is test do
var r = new AppGlobRoute("/user/:id/*")
assert not r.match("/")
assert not r.match("/user")
assert r.match("/user/10/profile")
end
- fun test_glob_route_work_with_parameters_4 do
+ fun test_glob_route_work_with_parameters_4 is test do
var r = new AppGlobRoute("/user/:id*")
assert not r.match("/")
assert not r.match("/user")
# See the License for the specific language governing permissions and
# limitations under the License.
-module test_popcorn is test_suite
+module test_popcorn is test
import pop_tests
import popcorn
class TestPopcornRouter
super TestPopcorn
+ test
redef fun client_test do
system "curl -s {host}:{port}"
system "curl -s {host}:{port}/products/not_found"
end
- fun test_router do
+ fun test_router is test do
var app = new App
app.use("/", new TestHandler("/"))
app.use("/about", new TestHandler("/about"))
class TestPopcornRoutes
super TestPopcorn
+ test
redef fun client_test do
system "curl -s {host}:{port}"
system "curl -s {host}:{port}/user/id/not_found"
end
- fun test_routes do
+ fun test_routes is test do
var app = new App
app.use("/", new TestHandler("/"))
app.use("/user", new TestHandler("/user"))