Fix unit tests for latest changes to API.
This commit is contained in:
parent
2622877db5
commit
ce7d4b60de
@ -145,7 +145,6 @@ template checkAuth() =
|
||||
debug "Auth failed: " & getCurrentExceptionMsg()
|
||||
response.data[2]["WWW-Authenticate"] = "Bearer"
|
||||
response.buildJson(Http401)
|
||||
return
|
||||
|
||||
proc start*(cfg: StrawBossConfig): void =
|
||||
|
||||
@ -167,12 +166,12 @@ proc start*(cfg: StrawBossConfig): void =
|
||||
let jsonBody = parseJson(request.body)
|
||||
uname = jsonBody["username"].getStr
|
||||
pwd = jsonBody["password"].getStr
|
||||
except: response.buildJson(Http400); return
|
||||
except: response.buildJson(Http400); return true
|
||||
|
||||
try:
|
||||
let authToken = makeAuthToken(cfg, uname, pwd)
|
||||
resp($(%authToken), JSON)
|
||||
except: response.buildJson(Http401, getCurrentExceptionMsg()); return
|
||||
except: response.buildJson(Http401, getCurrentExceptionMsg()); return true
|
||||
|
||||
get "/verify-auth":
|
||||
checkAuth(); if not authed: return true
|
||||
@ -192,7 +191,7 @@ proc start*(cfg: StrawBossConfig): void =
|
||||
checkAuth(); if not authed: return true
|
||||
|
||||
# TODO
|
||||
response.buildJson(Http501); return
|
||||
response.buildJson(Http501); return true
|
||||
|
||||
get "/project/@projectName":
|
||||
## Return a project's configuration, as well as it's versions.
|
||||
@ -443,7 +442,7 @@ proc start*(cfg: StrawBossConfig): void =
|
||||
return true
|
||||
|
||||
post "/service/debug/stop":
|
||||
if not cfg.debug: response.buildJson(Http404); return
|
||||
if not cfg.debug: response.buildJson(Http404); return true
|
||||
else:
|
||||
let shutdownFut = sleepAsync(100)
|
||||
shutdownFut.callback = proc(): void = complete(stopFuture)
|
||||
|
@ -135,12 +135,12 @@ suite "strawboss server":
|
||||
let completedRun = http.waitForBuild(apiBase, testProjName, $queuedRun.id)
|
||||
|
||||
# there should be successful status files for both the build and test steps
|
||||
for stepName in ["build", "test"]:
|
||||
let statusFile = tempBuildDataDir & "/" & testProjName & "/status/" & stepName & "/0.2.1.json"
|
||||
for step in [("build", BuildState.stepComplete), ("test", BuildState.complete)]:
|
||||
let statusFile = tempBuildDataDir & "/" & testProjName & "/status/" & step[0] & "/0.2.1.json"
|
||||
check fileExists(statusFile)
|
||||
|
||||
let status = loadBuildStatus(statusFile)
|
||||
check status.state == BuildState.complete
|
||||
check status.state == step[1]
|
||||
|
||||
#test "already completed steps should not be rebuilt":
|
||||
# let http = newAuthenticatedHttpClient(apibase, "bob@builder.com", "password")
|
||||
|
Loading…
x
Reference in New Issue
Block a user