Revision 303638316466 () - Diff

Link to this snippet: https://friendpaste.com/ElSBMc3Q2LBNMjlg1ECPw
Embed:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
diff --git a/test/etap/160-vhosts.t b/test/etap/160-vhosts.t
index 89a71de..729c2f7 100755
--- a/test/etap/160-vhosts.t
+++ b/test/etap/160-vhosts.t
@@ -155,9 +155,9 @@ test_regular_request() ->
test_vhost_request() ->
case ibrowse:send_req(server(), [], get, [], [{host_header, "example.com"}]) of
{ok, _, _, Body} ->
- {[{<<"db_name">>, <<"etap-test-db">>},_,_,_,_,_,_,_,_,_]}
- = ejson:decode(Body),
- etap:is(true, true, "should return database info");
+ {JsonBody} = ejson:decode(Body),
+ HasDbNameInfo = proplists:is_defined(<<"db_name">>, JsonBody),
+ etap:is(HasDbNameInfo, true, "should return database info");
_Else ->
etap:is(false, true, <<"ibrowse fail">>)
end.
@@ -222,9 +222,9 @@ test_vhost_request_wildcard()->
test_vhost_request_replace_var() ->
case ibrowse:send_req(server(), [], get, [], [{host_header,"etap-test-db.example1.com"}]) of
{ok, _, _, Body} ->
- {[{<<"db_name">>, <<"etap-test-db">>},_,_,_,_,_,_,_,_,_]}
- = ejson:decode(Body),
- etap:is(true, true, "should return database info");
+ {JsonBody} = ejson:decode(Body),
+ HasDbNameInfo = proplists:is_defined(<<"db_name">>, JsonBody),
+ etap:is(HasDbNameInfo, true, "should return database info");
_Else -> etap:is(false, true, <<"ibrowse fail">>)
end.
@@ -242,9 +242,9 @@ test_vhost_request_replace_var1() ->
test_vhost_request_replace_wildcard() ->
case ibrowse:send_req(server(), [], get, [], [{host_header,"etap-test-db.example2.com"}]) of
{ok, _, _, Body} ->
- {[{<<"db_name">>, <<"etap-test-db">>},_,_,_,_,_,_,_,_,_]}
- = ejson:decode(Body),
- etap:is(true, true, "should return database info");
+ {JsonBody} = ejson:decode(Body),
+ HasDbNameInfo = proplists:is_defined(<<"db_name">>, JsonBody),
+ etap:is(HasDbNameInfo, true, "should return database info");
_Else -> etap:is(false, true, <<"ibrowse fail">>)
end.
@@ -252,9 +252,9 @@ test_vhost_request_path() ->
Uri = server() ++ "test",
case ibrowse:send_req(Uri, [], get, [], [{host_header, "example.com"}]) of
{ok, _, _, Body} ->
- {[{<<"db_name">>, <<"etap-test-db">>},_,_,_,_,_,_,_,_,_]}
- = ejson:decode(Body),
- etap:is(true, true, "should return database info");
+ {JsonBody} = ejson:decode(Body),
+ HasDbNameInfo = proplists:is_defined(<<"db_name">>, JsonBody),
+ etap:is(HasDbNameInfo, true, "should return database info");
_Else -> etap:is(false, true, <<"ibrowse fail">>)
end.
@@ -272,9 +272,9 @@ test_vhost_request_path2() ->
Uri = server() ++ "test",
case ibrowse:send_req(Uri, [], get, [], [{host_header,"etap-test-db.example2.com"}]) of
{ok, _, _, Body} ->
- {[{<<"db_name">>, <<"etap-test-db">>},_,_,_,_,_,_,_,_,_]}
- = ejson:decode(Body),
- etap:is(true, true, "should return database info");
+ {JsonBody} = ejson:decode(Body),
+ HasDbNameInfo = proplists:is_defined(<<"db_name">>, JsonBody),
+ etap:is(HasDbNameInfo, true, "should return database info");
_Else -> etap:is(false, true, <<"ibrowse fail">>)
end.