Esempio n. 1
0
func TestFindTeamByPhrase(t *T) {
	beforeTeamTest()

	team, err := table.FindTeamByPhrase("phrase 1000")
	rdtest.Assert(t, err == nil, err)
	rdtest.Assert(t, team.TeamId == 100)
	rdtest.Assert(t, team.Phrase == "phrase 1000")
}
Esempio n. 2
0
func JoinTeam(
	phrase,
	telephoneNumber string) (u *record.User, t *record.Team, err error) {

	t, err = table.FindTeamByPhrase(phrase)
	if err != nil {
		return
	}

	u, err = table.CreateUser(telephoneNumber, t.TeamId)
	if err == table.DuplicateUser {
		u, err = table.FindUserByTelephoneTeam(telephoneNumber, t.TeamId)
	}
	return
}
Esempio n. 3
0
func TestFindTeamByPhrase_DoesntExist(t *T) {
	beforeTeamTest()

	_, err := table.FindTeamByPhrase("some phrase")
	rdtest.Assert(t, err == table.ErrBadPhrase)
}