generated from VLADIMIR/template
fix
This commit is contained in:
@@ -29,6 +29,7 @@ func TestTeamRegistrationHandler(t *testing.T) {
|
||||
{"malformed", "secret", "Bearer secret", "42", "delivery", `{`, nil, 400, false},
|
||||
{"extra object", "secret", "Bearer secret", "42", "delivery", valid + ` {}`, nil, 400, false},
|
||||
{"unknown field", "secret", "Bearer secret", "42", "delivery", `{"extra":1}`, nil, 400, false},
|
||||
{"jsonrpc", "secret", "Bearer secret", "42", "delivery", `{"jsonrpc":"2.0","method":"register","params":{"name":"Команда","email":"captain@example.org","participantsCount":5},"id":1}`, nil, 200, true},
|
||||
{"too large", "secret", "Bearer secret", "42", "delivery", `{"name":"` + strings.Repeat("a", 17000) + `"}`, nil, 400, false},
|
||||
{"invalid fields", "secret", "Bearer secret", "42", "delivery", valid, game_service.ErrInvalidRegistration, 400, true},
|
||||
{"closed", "secret", "Bearer secret", "42", "delivery", valid, teams_repo.ErrRegistrationClosed, 409, true},
|
||||
@@ -55,7 +56,7 @@ func TestTeamRegistrationHandler(t *testing.T) {
|
||||
if res.Code != tc.want || called != tc.called {
|
||||
t.Fatalf("status=%d called=%v body=%s", res.Code, called, res.Body.String())
|
||||
}
|
||||
if tc.want == 200 && res.Body.String() != "{\"id\":7}\n" {
|
||||
if tc.name == "success" && res.Body.String() != "{\"id\":7}\n" {
|
||||
t.Fatal(res.Body.String())
|
||||
}
|
||||
if strings.Contains(res.Body.String(), "private database detail") {
|
||||
@@ -70,6 +71,9 @@ func TestTeamRegistrationHandler(t *testing.T) {
|
||||
if tc.name == "extra object" && !strings.Contains(res.Body.String(), "лишние данные") {
|
||||
t.Fatalf("extra data reason missing: %s", res.Body.String())
|
||||
}
|
||||
if tc.name == "jsonrpc" && !strings.Contains(res.Body.String(), `"jsonrpc":"2.0"`) {
|
||||
t.Fatalf("JSON-RPC response missing: %s", res.Body.String())
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user