Esempio n. 1
0
func TestAsk(t *testing.T) {
	beforeHintTest()

	answer, err := hint.Ask(1)
	rdtest.Assert(t, err == nil, err)
	rdtest.Assert(t, answer == "Hint 1A", "Actual \"%s\"", answer)

	answer, err = hint.Ask(1)
	rdtest.Assert(t, err == nil, err)
	rdtest.Assert(t, answer == "Hint 1B", "Actual \"%s\"", answer)

	answer, err = hint.Ask(1)
	rdtest.Assert(t, err == hint.NoHintsLeft, err)
	rdtest.Assert(t, answer == "", "Actual \"%s\"", answer)

	answer, err = hint.Ask(1)
	rdtest.Assert(t, err == hint.NoHintsLeft, err)
	rdtest.Assert(t, answer == "", "Actual \"%s\"", answer)

}
Esempio n. 2
0
func takeHint(ctx *_Context) error {

	hint, err := hint.Ask(ctx.loggedIn.Team.TeamId)

	if err != nil {
		return err
	}

	ctx.resp = map[string]string{
		"hint": hint,
	}

	return nil
}