Fix tests
This commit is contained in:
		
							parent
							
								
									e27251ff5d
								
							
						
					
					
						commit
						77430d339a
					
				|  | @ -1,3 +1,3 @@ | ||||||
| DEPS:=mochiweb-wrapper webmachine-wrapper | DEPS:=mochiweb-wrapper webmachine-wrapper | ||||||
| WITH_BROKER_TEST_COMMANDS:=rabbit_mochiweb_test:test() | WITH_BROKER_TEST_COMMANDS:=rabbit_web_dispatch_test:test() | ||||||
| STANDALONE_TEST_COMMANDS:=rabbit_mochiweb_test_unit:test() | STANDALONE_TEST_COMMANDS:=rabbit_web_dispatch_test_unit:test() | ||||||
|  |  | ||||||
|  | @ -14,25 +14,25 @@ | ||||||
| %% Copyright (c) 2010-2013 VMware, Inc.  All rights reserved. | %% Copyright (c) 2010-2013 VMware, Inc.  All rights reserved. | ||||||
| %% | %% | ||||||
| 
 | 
 | ||||||
| -module(rabbit_mochiweb_test). | -module(rabbit_web_dispatch_test). | ||||||
| 
 | 
 | ||||||
| -include_lib("eunit/include/eunit.hrl"). | -include_lib("eunit/include/eunit.hrl"). | ||||||
| 
 | 
 | ||||||
| query_static_resource_test() -> | query_static_resource_test() -> | ||||||
|     %% TODO this is a fairly rubbish test, but not as bad as it was |     %% TODO this is a fairly rubbish test, but not as bad as it was | ||||||
|     rabbit_mochiweb:register_static_context(test, [{port, 12345}], |     rabbit_web_dispatch:register_static_context(test, [{port, 12345}], | ||||||
|                                             "rabbit_mochiweb_test", |                                                 "rabbit_web_dispatch_test", | ||||||
|                                             ?MODULE, "priv/www", "Test"), |                                                 ?MODULE, "priv/www", "Test"), | ||||||
|     {ok, {_Status, _Headers, Body}} = |     {ok, {_Status, _Headers, Body}} = | ||||||
|         httpc:request("http://localhost:12345/rabbit_mochiweb_test/index.html"), |         httpc:request("http://localhost:12345/rabbit_web_dispatch_test/index.html"), | ||||||
|     ?assert(string:str(Body, "RabbitMQ HTTP Server Test Page") /= 0). |     ?assert(string:str(Body, "RabbitMQ HTTP Server Test Page") /= 0). | ||||||
| 
 | 
 | ||||||
| add_idempotence_test() -> | add_idempotence_test() -> | ||||||
|     F = fun(_Req) -> ok end, |     F = fun(_Req) -> ok end, | ||||||
|     L = {"/foo", "Foo"}, |     L = {"/foo", "Foo"}, | ||||||
|     rabbit_mochiweb_registry:add(foo, [{port, 12345}], F, F, L), |     rabbit_web_dispatch_registry:add(foo, [{port, 12345}], F, F, L), | ||||||
|     rabbit_mochiweb_registry:add(foo, [{port, 12345}], F, F, L), |     rabbit_web_dispatch_registry:add(foo, [{port, 12345}], F, F, L), | ||||||
|     ?assertEqual( |     ?assertEqual( | ||||||
|        1, length([ok || {"/foo", _, _} <- |        1, length([ok || {"/foo", _, _} <- | ||||||
|                             rabbit_mochiweb_registry:list_all()])), |                             rabbit_web_dispatch_registry:list_all()])), | ||||||
|     passed. |     passed. | ||||||
|  | @ -14,27 +14,27 @@ | ||||||
| %% Copyright (c) 2010-2013 VMware, Inc.  All rights reserved. | %% Copyright (c) 2010-2013 VMware, Inc.  All rights reserved. | ||||||
| %% | %% | ||||||
| 
 | 
 | ||||||
| -module(rabbit_mochiweb_test_unit). | -module(rabbit_web_dispatch_test_unit). | ||||||
| 
 | 
 | ||||||
| -include_lib("eunit/include/eunit.hrl"). | -include_lib("eunit/include/eunit.hrl"). | ||||||
| 
 | 
 | ||||||
| relativise_test() -> | relativise_test() -> | ||||||
|     ?assertEqual("baz", |     ?assertEqual("baz", | ||||||
|                  rabbit_mochiweb_util:relativise("/foo/bar/bash", |                  rabbit_web_dispatch_util:relativise("/foo/bar/bash", | ||||||
|                                                  "/foo/bar/baz")), |                                                  "/foo/bar/baz")), | ||||||
|     ?assertEqual("../bax/baz", |     ?assertEqual("../bax/baz", | ||||||
|                  rabbit_mochiweb_util:relativise("/foo/bar/bash", |                  rabbit_web_dispatch_util:relativise("/foo/bar/bash", | ||||||
|                                                  "/foo/bax/baz")), |                                                  "/foo/bax/baz")), | ||||||
|     ?assertEqual("../bax/baz", |     ?assertEqual("../bax/baz", | ||||||
|                  rabbit_mochiweb_util:relativise("/bar/bash", |                  rabbit_web_dispatch_util:relativise("/bar/bash", | ||||||
|                                                  "/bax/baz")), |                                                  "/bax/baz")), | ||||||
|     ?assertEqual("..", |     ?assertEqual("..", | ||||||
|                  rabbit_mochiweb_util:relativise("/foo/bar/bash", |                  rabbit_web_dispatch_util:relativise("/foo/bar/bash", | ||||||
|                                                  "/foo/bar")), |                                                  "/foo/bar")), | ||||||
|     ?assertEqual("../..", |     ?assertEqual("../..", | ||||||
|                  rabbit_mochiweb_util:relativise("/foo/bar/bash", |                  rabbit_web_dispatch_util:relativise("/foo/bar/bash", | ||||||
|                                                  "/foo")), |                                                  "/foo")), | ||||||
|     ?assertEqual("bar/baz", |     ?assertEqual("bar/baz", | ||||||
|                  rabbit_mochiweb_util:relativise("/foo/bar", |                  rabbit_web_dispatch_util:relativise("/foo/bar", | ||||||
|                                                  "/foo/bar/baz")), |                                                  "/foo/bar/baz")), | ||||||
|     ?assertEqual("foo", rabbit_mochiweb_util:relativise("/", "/foo")). |     ?assertEqual("foo", rabbit_web_dispatch_util:relativise("/", "/foo")). | ||||||
		Loading…
	
		Reference in New Issue