Add HTTP API package
authorMaciej Wereski <m.wereski@partner.samsung.com>
Thu, 31 Aug 2017 14:11:31 +0000 (16:11 +0200)
committerMaciej Wereski <m.wereski@partner.samsung.com>
Tue, 5 Jun 2018 09:24:40 +0000 (11:24 +0200)
commit3ff7b1c9503b94d9975ea8f9708510950a5f2484
treedfd60cbca86e6aadbc35f2dca98a9a40d11d03ee
parent3c4328d544a9cf55f0290dd4be90918140d414d5
Add HTTP API package

HTTP API package will provide all HTTP API which will be exposed to the
Boruta clients. Only User API counterpart of Boruta is added for now.
Currently the package provides only one function, which takes pointer to
httprouter.Router and registers all paths and HTTP methods in it.

HTTP API module will have a lot of test cases agregated in test tables.
To improve test cases development time and readability of test files,
flag '-update' is added to test. It will run tests and for all
testcases a file with results will be generated in 'testdata'
subdirectory. During testing (running without '-update' flag) those
files are read and compared with results of tested functions.

Generating testcase files:
$ go test git.tizen.org/tools/boruta/server/api/v1 -update
Testing (as usual):
$ go test git.tizen.org/tools/boruta/server/api/v1

After updating testcase files output must be inspected by developer
before commiting to the repository (and should be also checked by
reviewers before merging).

Change-Id: I6d98f093cce116512dc305e07a8614990580faff
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
21 files changed:
boruta.go
mocks/mock_requests.go [new file with mode: 0644]
mocks/mock_workers.go [new file with mode: 0644]
server/api/v1/api.go [new file with mode: 0644]
server/api/v1/api_test.go [new file with mode: 0644]
server/api/v1/error.go [new file with mode: 0644]
server/api/v1/handlers.go [new file with mode: 0644]
server/api/v1/handlers_test.go [new file with mode: 0644]
server/api/v1/testdata/acquire-worker-POST.json [new file with mode: 0644]
server/api/v1/testdata/close-req-POST.json [new file with mode: 0644]
server/api/v1/testdata/list-reqs-all-GET.json [new file with mode: 0644]
server/api/v1/testdata/list-reqs-filter-POST.json [new file with mode: 0644]
server/api/v1/testdata/list-workers-all-GET.json [new file with mode: 0644]
server/api/v1/testdata/list-workers-filter-POST.json [new file with mode: 0644]
server/api/v1/testdata/new-req-POST.json [new file with mode: 0644]
server/api/v1/testdata/panic-other-error.txt [new file with mode: 0644]
server/api/v1/testdata/panic-server-error.txt [new file with mode: 0644]
server/api/v1/testdata/prolong-access-POST.json [new file with mode: 0644]
server/api/v1/testdata/req-info-GET.json [new file with mode: 0644]
server/api/v1/testdata/update-req-POST.json [new file with mode: 0644]
server/api/v1/testdata/worker-info-GET.json [new file with mode: 0644]