예제 #1
0
// generate some number of organization objects in JSON
func generateOrganizationJson() string {
	jsn := u.GenerateJson(
		"organizations",
		map[string]func() interface{}{
			"name":             u.GenerateWord,
			"slug":             u.GenerateSlug,
			"location":         u.GenerateName,
			"default_timezone": func() interface{} { return "US/Pacific" },
		},
		-1,
	)

	return jsn
}
예제 #2
0
파일: members.go 프로젝트: Chandler/goflesh
// generate some number of organization objects in JSON
func generateMemberJson() string {
	u.InsertTestUser()
	u.InsertTestOrganization()
	u.InsertTestGame()
	jsn := u.GenerateJson(
		"members",
		map[string]func() interface{}{
			"user_id":         func() interface{} { return u.SelectTestUser().Id },
			"organization_id": func() interface{} { return u.SelectTestOrganization().Id },
		},
		1,
	)

	return jsn
}
예제 #3
0
파일: game.go 프로젝트: Chandler/goflesh
// generate some number of user objects in JSON
func generateGameJson() string {
	u.InsertTestOrganization()
	now := time.Now().UTC()
	later := now.Add(12 * time.Hour)
	tomorrow := now.Add(24 * time.Hour)
	tomorrowLater := later.Add(24 * time.Hour)
	jsn := u.GenerateJson(
		"games",
		map[string]func() interface{}{
			"name":                    u.GenerateWord,
			"slug":                    u.GenerateSlug,
			"organization_id":         getOrganizationId,
			"timezone":                func() interface{} { return "US/Pacific" },
			"registration_start_time": func() interface{} { return now.Format(time.RFC3339) },
			"registration_end_time":   func() interface{} { return tomorrow.Format(time.RFC3339) },
			"running_start_time":      func() interface{} { return later.Format(time.RFC3339) },
			"running_end_time":        func() interface{} { return tomorrowLater.Format(time.RFC3339) },
		},
		1,
	)

	return jsn
}