private async Task <bool> RepoShipNeedsWebhookHelpHelper(bool hasHook, bool isAdmin) { using (var context = new ShipHubContext()) { var userAccount = TestUtil.MakeTestUser(context); var orgAccount = new AccountTableType() { Id = 4001, Login = "******", Type = "org", }; var repo = new RepositoryTableType() { Id = 5001, AccountId = 4001, Name = "unicorns", FullName = "pureimaginary/unicorns", Private = true, HasIssues = true, }; await context.BulkUpdateAccounts(DateTimeOffset.UtcNow, new[] { orgAccount }); var user = context.Users.Single(x => x.Id == userAccount.Id); await context.SaveChangesAsync(); await context.BulkUpdateRepositories(DateTimeOffset.UtcNow, new[] { repo }); await context.SetUserOrganizations(user.Id, new[] { orgAccount.Id }); await context.SetAccountLinkedRepositories( userAccount.Id, new[] { (repo.Id, isAdmin) });
public async Task CanGetAccounts() { using (var context = new ShipHubContext()) { var user = TestUtil.MakeTestUser(context); var org1 = TestUtil.MakeTestOrg(context, 6001, "myorg1"); var org2 = TestUtil.MakeTestOrg(context, 6002, "myorg2"); var org3 = TestUtil.MakeTestOrg(context, 6003, "myorg3"); var org1Repo = TestUtil.MakeTestRepo(context, org1.Id, 2001, "org1repo"); var org2Repo = TestUtil.MakeTestRepo(context, org2.Id, 2002, "org2repo"); var org3Repo = TestUtil.MakeTestRepo(context, org3.Id, 2003, "org3repo"); await context.SetAccountLinkedRepositories(user.Id, new[] {
public async Task UsersCanBecomeOrgs() { using (var context = new ShipHubContext()) { var user1 = TestUtil.MakeTestUser(context, 3001, "user1"); var user2 = TestUtil.MakeTestUser(context, 3002, "user2"); var user3 = TestUtil.MakeTestUser(context, 3003, "user3"); var repo1 = TestUtil.MakeTestRepo(context, user1.Id, 2001, "unicorns1"); var repo2 = TestUtil.MakeTestRepo(context, user1.Id, 2002, "unicorns2"); var repo3 = TestUtil.MakeTestRepo(context, user2.Id, 2003, "unicorns3"); var repo4 = TestUtil.MakeTestRepo(context, user3.Id, 2004, "unicorns4"); var org1 = TestUtil.MakeTestOrg(context, 6001, "org1"); var org2 = TestUtil.MakeTestOrg(context, 6002, "org2"); await context.SaveChangesAsync(); await context.SetAccountLinkedRepositories(user1.Id, new[] {