public async Task Controller_PATCH_APIKey() { var controller = new ApiKeyController(User, Manager); var str = await PostTestAPIKey(); var res = await controller.PatchAsync(str, new ApiKeyUpdate() { Description = "TestKey", UseNum = 0 }) as JsonResult; var obj = res.Value as Models.Output.Admin.ApiKey; Assert.AreEqual("TestKey", obj.Description); Assert.AreEqual(AuthorizeApiKey.Authentication | AuthorizeApiKey.Registration | AuthorizeApiKey.Standard, obj.Flags); Assert.AreEqual(0, obj.UseNum); User.SetPermissions(new string[] { }); Assert.ThrowsAsync <Shared.Exceptions.InsuficientPermission>(() => controller.PatchAsync(str, null)); }