test unhappy swap
This commit is contained in:
@@ -209,6 +209,33 @@ func TestServeGM(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("swap", func(t *testing.T) {
|
||||
t.Run("self", func(t *testing.T) {
|
||||
v01 := NewV01(ctx, nil)
|
||||
v01.cfg.Quiet = true
|
||||
v01.cfg.Users = map[string]configUser{
|
||||
"bel": configUser{Player: 1},
|
||||
}
|
||||
resp := do(v01, "/gm/rpc/swap?a=bel&b=bel", "")
|
||||
if resp.Code != http.StatusConflict {
|
||||
t.Error(resp.Code)
|
||||
}
|
||||
if !v01.cfg.Quiet {
|
||||
t.Error(v01.cfg.Quiet)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("who", func(t *testing.T) {
|
||||
v01 := NewV01(ctx, nil)
|
||||
v01.cfg.Quiet = true
|
||||
resp := do(v01, "/gm/rpc/swap?a=bel", "")
|
||||
if resp.Code != http.StatusBadRequest {
|
||||
t.Error(resp.Code)
|
||||
}
|
||||
if !v01.cfg.Quiet {
|
||||
t.Error(v01.cfg.Quiet)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("happy", func(t *testing.T) {
|
||||
v01 := NewV01(ctx, nil)
|
||||
v01.cfg.Quiet = true
|
||||
|
||||
Reference in New Issue
Block a user