mirror of
https://github.com/semaphoreui/semaphore.git
synced 2025-01-20 15:29:28 +01:00
test: fix dredd tests
This commit is contained in:
parent
c12c490b5c
commit
221f8db31c
26
api-docs.yml
26
api-docs.yml
@ -50,12 +50,35 @@ definitions:
|
||||
name:
|
||||
type: string
|
||||
x-example: Integration Test User
|
||||
example: Integration Test User
|
||||
username:
|
||||
type: string
|
||||
x-example: test-user
|
||||
example: test-user
|
||||
email:
|
||||
type: string
|
||||
x-example: test@ansiblesemaphore.test
|
||||
example: test@ansiblesemaphore.test
|
||||
alert:
|
||||
type: boolean
|
||||
admin:
|
||||
type: boolean
|
||||
|
||||
UserPutRequest:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
x-example: Integration Test User2
|
||||
example: Integration Test User2
|
||||
username:
|
||||
type: string
|
||||
x-example: test-user2
|
||||
example: test-user2
|
||||
email:
|
||||
type: string
|
||||
x-example: test2@ansiblesemaphore.test
|
||||
example: test2@ansiblesemaphore.test
|
||||
alert:
|
||||
type: boolean
|
||||
admin:
|
||||
@ -131,6 +154,7 @@ definitions:
|
||||
type: string
|
||||
secret:
|
||||
type: string
|
||||
example: test
|
||||
AccessKey:
|
||||
type: object
|
||||
properties:
|
||||
@ -618,7 +642,7 @@ paths:
|
||||
in: body
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/UserRequest"
|
||||
$ref: "#/definitions/UserPutRequest"
|
||||
responses:
|
||||
204:
|
||||
description: User Updated
|
||||
|
@ -7,20 +7,10 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/ansible-semaphore/semaphore/util"
|
||||
"github.com/go-openapi/loads"
|
||||
"github.com/go-openapi/spec"
|
||||
)
|
||||
|
||||
func mockParam(w http.ResponseWriter, r *http.Request) {
|
||||
_, err := util.GetIntParam("test_id", w, r)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
w.WriteHeader(200)
|
||||
}
|
||||
|
||||
func TestApiPing(t *testing.T) {
|
||||
req, _ := http.NewRequest("GET", "/api/ping", nil)
|
||||
rr := httptest.NewRecorder()
|
||||
|
@ -102,7 +102,9 @@ func updateUser(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if _, err := db.Mysql.Exec("update user set name=?, username=?, email=?, alert=?, admin=? where id=?", user.Name, user.Username, user.Email, user.Alert, user.Admin, oldUser.ID); err != nil {
|
||||
panic(err)
|
||||
log.Error(err.Error())
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
|
Loading…
Reference in New Issue
Block a user