Split testing into unit and functional tests.
* Split the `test` nimble task into `unittest` and `functest`, with corresponding test directories and test runners. * Added documentation in README regarding building and testing StrawBoss. * Created a small, simple test project for use in the functional tests. * Added a `keepEnv` template in the server unit test code to make it easy to preserve the working environment for a single unit test to invistigate failures manually.
This commit is contained in:
9
src/test/nim/testutil.nim
Normal file
9
src/test/nim/testutil.nim
Normal file
@ -0,0 +1,9 @@
|
||||
import httpclient, json, strutils
|
||||
|
||||
proc newAuthenticatedHttpClient*(apiBase, uname, pwd: string): HttpClient =
|
||||
result = newHttpClient()
|
||||
let authResp = result.post(apiBase & "/auth-token", $(%*{"username": uname, "password": pwd}))
|
||||
assert authResp.status.startsWith("200")
|
||||
result.headers = newHttpHeaders({"Authorization": "Bearer " & parseJson(authResp.body).getStr})
|
||||
|
||||
|
Reference in New Issue
Block a user