25 lines
714 B
Go
25 lines
714 B
Go
package e2e
|
|
|
|
import (
|
|
"encoding/json"
|
|
"github.com/stretchr/testify/assert"
|
|
"gitlab.hpi.de/codeocean/codemoon/poseidon/api"
|
|
"gitlab.hpi.de/codeocean/codemoon/poseidon/api/dto"
|
|
"net/http"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestProvideRunnerRoute(t *testing.T) {
|
|
reader := strings.NewReader(`{"executionEnvironmentId":0}`)
|
|
resp, err := http.Post(buildURL(api.RouteRunners), "application/json", reader)
|
|
assert.NoError(t, err)
|
|
assert.Equal(t, http.StatusOK, resp.StatusCode, "The response code should be ok")
|
|
|
|
runnerResponse := new(dto.ResponseRunner)
|
|
err = json.NewDecoder(resp.Body).Decode(runnerResponse)
|
|
assert.NoError(t, err)
|
|
|
|
assert.True(t, runnerResponse.Id != "", "The response contains a runner id")
|
|
}
|