mirror of
https://github.com/unmojang/drasl.git
synced 2026-02-04 06:33:19 +02:00
some services tests
This commit is contained in:
@@ -96,7 +96,7 @@ func (ts *TestSuite) testSessionHasJoined(t *testing.T) {
|
||||
assert.Nil(t, ts.App.DB.Save(&user).Error)
|
||||
|
||||
url := "/session/minecraft/hasJoined?username=" + user.PlayerName + "&serverId=" + serverID + "&ip=" + "127.0.0.1"
|
||||
rec := ts.Get(ts.Server, url, nil)
|
||||
rec := ts.Get(ts.Server, url, nil, nil)
|
||||
ts.CheckAuthlibInjectorHeader(t, ts.App, rec)
|
||||
assert.Equal(t, http.StatusOK, rec.Code)
|
||||
|
||||
@@ -115,7 +115,7 @@ func (ts *TestSuite) testSessionHasJoined(t *testing.T) {
|
||||
assert.Nil(t, ts.App.DB.Save(&user).Error)
|
||||
|
||||
url := "/session/minecraft/hasJoined?username=" + user.PlayerName + "&serverId=" + "invalid" + "&ip=" + "127.0.0.1"
|
||||
rec := ts.Get(ts.Server, url, nil)
|
||||
rec := ts.Get(ts.Server, url, nil, nil)
|
||||
ts.CheckAuthlibInjectorHeader(t, ts.App, rec)
|
||||
assert.Equal(t, http.StatusForbidden, rec.Code)
|
||||
}
|
||||
@@ -129,7 +129,7 @@ func (ts *TestSuite) testSessionProfile(t *testing.T) {
|
||||
// Successfully get profile
|
||||
|
||||
url := "/session/minecraft/profile/" + Unwrap(UUIDToID(user.UUID))
|
||||
rec := ts.Get(ts.Server, url, nil)
|
||||
rec := ts.Get(ts.Server, url, nil, nil)
|
||||
ts.CheckAuthlibInjectorHeader(t, ts.App, rec)
|
||||
assert.Equal(t, http.StatusOK, rec.Code)
|
||||
|
||||
@@ -142,14 +142,14 @@ func (ts *TestSuite) testSessionProfile(t *testing.T) {
|
||||
{
|
||||
// If the UUID doesn't exist, we should get a StatusNoContent
|
||||
url := "/session/minecraft/profile/" + "00000000000000000000000000000000"
|
||||
rec := ts.Get(ts.Server, url, nil)
|
||||
rec := ts.Get(ts.Server, url, nil, nil)
|
||||
ts.CheckAuthlibInjectorHeader(t, ts.App, rec)
|
||||
assert.Equal(t, http.StatusNoContent, rec.Code)
|
||||
}
|
||||
{
|
||||
// If the UUID is invalid, we should get a StatusBadRequest with an error message
|
||||
url := "/session/minecraft/profile/" + "invalid"
|
||||
rec := ts.Get(ts.Server, url, nil)
|
||||
rec := ts.Get(ts.Server, url, nil, nil)
|
||||
ts.CheckAuthlibInjectorHeader(t, ts.App, rec)
|
||||
assert.Equal(t, http.StatusBadRequest, rec.Code)
|
||||
|
||||
@@ -160,6 +160,6 @@ func (ts *TestSuite) testSessionProfile(t *testing.T) {
|
||||
}
|
||||
|
||||
func (ts *TestSuite) testSessionBlockedServers(t *testing.T) {
|
||||
rec := ts.Get(ts.Server, "/blockedservers", nil)
|
||||
rec := ts.Get(ts.Server, "/blockedservers", nil, nil)
|
||||
assert.Equal(t, http.StatusOK, rec.Code)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user