Beispiel #1
0
        public async Task DeletionWorks()
        {
            await firstContext.CreateUser(firstAuth);

            var groupId = await firstGroups.UpsertGroup(DefaultGroup());

            var before = await firstGroups.List();

            await firstGroups.DeleteGroup(groupId);

            var after = await firstGroups.List();

            Assert.Single(before);
            Assert.Empty(after);
        }
Beispiel #2
0
        public async Task DeletionFailsWhenUserDoesNotOwnAGroup()
        {
            await firstContext.CreateUser(firstAuth);

            await secondContext.CreateUser(secondAuth, "SecondFellow");

            var groupId = await firstGroups.UpsertGroup(DefaultGroup());

            var exception = await Assert.ThrowsAsync <DatesException>(async() =>
            {
                await secondGroups.DeleteGroup(groupId);
            });

            Assert.Equal("You do not own this group. No permission for editing", exception.Message);
        }
Beispiel #3
0
 public IActionResult DeleteGroup([FromBody] GroupKey groupKey)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     try
     {
         _groupsService.DeleteGroup(groupKey);
         return(Ok());
     }
     catch (Exception)
     {
         return(BadRequest("You are not the admin of this group!"));
     }
 }
Beispiel #4
0
 public ActionResult <string> DeleteGroup(string id)
 {
     _service.DeleteGroup(id);
     return(id);
 }
 public Task DeleteGroup([FromRoute] int id)
 {
     return(groupsService.DeleteGroup(id));
 }