func createRepo(t *testing.T, record bool) string { // create repo repo := TestPrefix + faker.Internet().UserName() req := Client.NewRequest(t, "POST", "/user/repos", jsons.Parse(`{"name": %q}`, repo)) if record { req.EnableRecording("repo_create.apib") } j := Client.Do(t, req, 201).JSON(t) assert.Equal(t, jsons.Parse(`{"name": %q, "full_name": %q}`, repo, Login+"/"+repo), j.KeepFields("name", "full_name")) assert.Equal(t, jsons.Parse(`{"login": %q}`, Login), j.Get("/owner").KeepFields("login")) return repo }
// generateAccount creates a new Snapchat account based on Snapchat's registration requirements. // NOTE: This will save sensitive credentials. Use with caution. func generateAccount(gmail, gpassword, key, secret string) *GeneratedSCAccount { genSnapchatAccount := &GeneratedSCAccount{ CasperAPIKey: key, CasperAPISecret: secret, } fakedate := faker.Date().Birthday(13, 34).Format("2006-01-02") age, err := ghost.CalculateAge(fakedate) if err != nil { fmt.Println(err) } genSnapchatAccount.Username = faker.Internet().UserName() + faker.Number().Hexadecimal(4) genSnapchatAccount.Email = faker.Internet().Email() genSnapchatAccount.Age = age genSnapchatAccount.Password = faker.Internet().Password(10, 20) genSnapchatAccount.Gmail = gmail genSnapchatAccount.Birthday = fakedate genSnapchatAccount.GmailPassword = gpassword return genSnapchatAccount }