Skip to content

Commit

Permalink
tweak test expect for new jsonschema lib
Browse files Browse the repository at this point in the history
  • Loading branch information
spacewander committed Nov 27, 2020
1 parent 2308af8 commit 0e00766
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 17 deletions.
2 changes: 1 addition & 1 deletion t/admin/health-check.t
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ GET /t
GET /t
--- error_code: 400
--- response_body
{"error_msg":"invalid configuration: property \"upstream\" validation failed: property \"checks\" validation failed: property \"active\" validation failed: property \"healthy\" validation failed: property \"http_statuses\" validation failed: expected unique items but items 2 and 1 are equal"}
{"error_msg":"invalid configuration: property \"upstream\" validation failed: property \"checks\" validation failed: property \"active\" validation failed: property \"healthy\" validation failed: property \"http_statuses\" validation failed: expected unique items but items 1 and 2 are equal"}
--- no_error_log
[error]
Expand Down
2 changes: 1 addition & 1 deletion t/plugin/api-breaker.t
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ GET /t
GET /t
--- error_code: 400
--- response_body
{"error_msg":"failed to check the configuration of plugin api-breaker err: property \"healthy\" validation failed: property \"http_statuses\" validation failed: expected unique items but items 2 and 1 are equal"}
{"error_msg":"failed to check the configuration of plugin api-breaker err: property \"healthy\" validation failed: property \"http_statuses\" validation failed: expected unique items but items 1 and 2 are equal"}
--- no_error_log
[error]

Expand Down
54 changes: 45 additions & 9 deletions t/plugin/basic-auth.t
Original file line number Diff line number Diff line change
Expand Up @@ -291,29 +291,65 @@ GET /t


=== TEST 12: get the default schema
--- request
GET /apisix/admin/schema/plugins/basic-auth
--- response_body
--- config
location /t {
content_by_lua_block {
local t = require("lib.test_admin").test
local code, body = t('/apisix/admin/schema/plugins/basic-auth',
ngx.HTTP_GET,
nil,
[[
{"properties":{"disable":{"type":"boolean"}},"title":"work with route or service object","additionalProperties":false,"type":"object"}
]]
)
ngx.status = code
}
}
--- request
GET /t
--- no_error_log
[error]



=== TEST 13: get the schema by schema_type
--- request
GET /apisix/admin/schema/plugins/basic-auth?schema_type=consumer
--- response_body
--- config
location /t {
content_by_lua_block {
local t = require("lib.test_admin").test
local code, body = t('/apisix/admin/schema/plugins/basic-auth?schema_type=consumer',
ngx.HTTP_GET,
nil,
[[
{"title":"work with consumer object","additionalProperties":false,"required":["username","password"],"properties":{"username":{"type":"string"},"password":{"type":"string"}},"type":"object"}
]]
)
ngx.status = code
}
}
--- request
GET /t
--- no_error_log
[error]



=== TEST 14: get the schema by error schema_type
--- request
GET /apisix/admin/schema/plugins/basic-auth?schema_type=consumer123123
--- response_body
--- config
location /t {
content_by_lua_block {
local t = require("lib.test_admin").test
local code, body = t('/apisix/admin/schema/plugins/basic-auth?schema_type=consumer123123',
ngx.HTTP_GET,
nil,
[[
{"properties":{"disable":{"type":"boolean"}},"title":"work with route or service object","additionalProperties":false,"type":"object"}
]]
)
ngx.status = code
}
}
--- request
GET /t
--- no_error_log
[error]
36 changes: 30 additions & 6 deletions t/plugin/hmac-auth.t
Original file line number Diff line number Diff line change
Expand Up @@ -1259,10 +1259,22 @@ x-real-ip: 127.0.0.1


=== TEST 32: get the default schema
--- request
GET /apisix/admin/schema/plugins/hmac-auth
--- response_body
--- config
location /t {
content_by_lua_block {
local t = require("lib.test_admin").test
local code, body = t('/apisix/admin/schema/plugins/hmac-auth',
ngx.HTTP_GET,
nil,
[[
{"properties":{"disable":{"type":"boolean"}},"title":"work with route or service object","additionalProperties":false,"type":"object"}
]]
)
ngx.status = code
}
}
--- request
GET /t
--- no_error_log
[error]

Expand All @@ -1279,10 +1291,22 @@ GET /apisix/admin/schema/plugins/hmac-auth?schema_type=consumer


=== TEST 34: get the schema by error schema_type
--- request
GET /apisix/admin/schema/plugins/hmac-auth?schema_type=consumer123123
--- response_body
--- config
location /t {
content_by_lua_block {
local t = require("lib.test_admin").test
local code, body = t('/apisix/admin/schema/plugins/hmac-auth?schema_type=consumer123123',
ngx.HTTP_GET,
nil,
[[
{"properties":{"disable":{"type":"boolean"}},"title":"work with route or service object","additionalProperties":false,"type":"object"}
]]
)
ngx.status = code
}
}
--- request
GET /t
--- no_error_log
[error]

Expand Down

0 comments on commit 0e00766

Please sign in to comment.