-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* init dredd with user controller api post create user * add apib for api group[post] status OK * add apib for api group[post] when group already exist return http status Unprocessable Entity * add apib for api group[post] when wrong token should return Unauthorized * completing api blueprint schema * add apib for api user[GET] for status OK * add apib for api user[GET] when user is not found should return http Status Not Found * add apib for api update user[POST] should return http status OK * add apib for api update user[POST] when token is wrong should return http status Unauthorized * add apib for api create vpns[POST] return http status OK * add apib for api create vpns[POST] when token is wrong should return http status Unauthorized * update travis.yml to support dredd test * Revert "update travis.yml to support dredd test" This reverts commit dc0b6d9. * cleanup description APIB * add dredd_hooks to Gemfile * add dredd setup to readme * remove unused file and folder at api_blueprints * fix typo in dredd_setup from againts to against * rename dredd folder to api_blueprint folder, and sync the dredd config
- Loading branch information
Showing
11 changed files
with
601 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
# dredd_server.sh | ||
kill -9 $(lsof -i tcp:9865 -t) | ||
export RAILS_ENV=test | ||
export LOG_LEVEL=info | ||
rake db:drop | ||
rake db:setup | ||
bundle exec rails server --port=9865 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
FORMAT: 1A | ||
|
||
# API Group | ||
|
||
# Group [/api/v1/groups] | ||
|
||
## Create Groups [POST] | ||
Create new group | ||
|
||
+ Request(application/json) | ||
|
||
+ Body | ||
|
||
{ | ||
"access_token": "token", | ||
"name" : "foo" | ||
} | ||
|
||
+ Schema | ||
|
||
{ | ||
"type": "object", | ||
"properties" : { | ||
"name" : { | ||
"type" : "string" | ||
}, | ||
"access_token" : { | ||
"type" : "string" | ||
} | ||
} | ||
} | ||
|
||
+ Response 200 | ||
|
||
+ Headers | ||
|
||
x-frame-options: SAMEORIGIN | ||
x-xss-protection: 1; mode=block | ||
x-content-type-options: nosniff | ||
content-type: application/json; charset=utf-8 | ||
etag: W/"5c15461069e69109955c72671ffc465d" | ||
cache-control: max-age=0, private, must-revalidate | ||
x-request-id: 0613ec11-afd7-4dc0-9096-fee607d71c12 | ||
x-runtime: 0.073641 | ||
connection: close | ||
transfer-encoding: chunked | ||
|
||
+ Body | ||
|
||
{ | ||
"id": 1, | ||
"name": "foo" | ||
} | ||
+ Schema | ||
|
||
{ | ||
"type": "object", | ||
"properties" : { | ||
"id" : { | ||
"type" : "int" | ||
}, | ||
"name" : { | ||
"type" : "string" | ||
} | ||
} | ||
} | ||
|
||
+ Request(application/json) | ||
|
||
+ Body | ||
|
||
{ | ||
"access_token": "token", | ||
"name" : "foo" | ||
} | ||
|
||
+ Schema | ||
|
||
{ | ||
"type": "object", | ||
"properties" : { | ||
"name" : { | ||
"type" : "string" | ||
}, | ||
"access_token" : { | ||
"type" : "string" | ||
} | ||
} | ||
} | ||
|
||
+ Response 422 | ||
|
||
+ Headers | ||
|
||
x-frame-options: SAMEORIGIN | ||
x-xss-protection: 1; mode=block | ||
x-content-type-options: nosniff | ||
content-type: application/json; charset=utf-8 | ||
cache-control: no-cache | ||
x-request-id: 30ec7a3a-4794-435b-a5b9-8ff480cd648c | ||
x-runtime: 0.007976 | ||
connection: close | ||
transfer-encoding: chunked | ||
|
||
+ Body | ||
|
||
{ | ||
"status": "group already exist", | ||
"id": 1, | ||
"name": "foo" | ||
} | ||
+ Schema | ||
|
||
{ | ||
"type": "object", | ||
"properties" : { | ||
"status" : { | ||
"type" : "string" | ||
}, | ||
"id" : { | ||
"type" : "int" | ||
}, | ||
"name" : { | ||
"type" : "string" | ||
} | ||
} | ||
} | ||
|
||
+ Request(application/json) | ||
|
||
+ Body | ||
|
||
{ | ||
"access_token": "wrong token", | ||
"name" : "foo" | ||
} | ||
|
||
+ Schema | ||
|
||
{ | ||
"type": "object", | ||
"properties" : { | ||
"name" : { | ||
"type" : "string" | ||
}, | ||
"access_token" : { | ||
"type" : "string" | ||
} | ||
} | ||
} | ||
|
||
+ Response 401 | ||
|
||
+ Headers | ||
|
||
x-frame-options: SAMEORIGIN | ||
x-xss-protection: 1; mode=block | ||
x-content-type-options: nosniff | ||
content-type: text/html | ||
cache-control: no-cache | ||
x-request-id: 30276bf6-0ce6-4ba6-b87d-7528b4f2c85d | ||
x-runtime: 0.002650 | ||
connection: close | ||
transfer-encoding: chunked | ||
|
||
+ Body |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
ENV['RAILS_ENV'] ||= 'test' | ||
|
||
require File.expand_path('../../config/environment', __dir__) | ||
require 'dredd_hooks/methods' | ||
|
||
include DreddHooks::Methods | ||
|
||
before_all do |_| | ||
user = User.create(name: 'foo', email: '[email protected]', admin: 1) | ||
access_token = AccessToken.new | ||
access_token.token = 'token' | ||
access_token.user = user | ||
user.access_token = access_token | ||
access_token.save! | ||
user.save! | ||
end |
Oops, something went wrong.