public async Task Should_manage_settings() { // STEP 1: Get initial settings. var settings_0 = await _.Apps.GetAppSettingsAsync(_.AppName); Assert.NotEmpty(settings_0.Patterns); Assert.Empty(settings_0.Editors); // STEP 2: Update settings with new state. var updateRequest = new UpdateAppSettingsDto { Patterns = settings_0.Patterns, Editors = new List <EditorDto> { new EditorDto { Name = "editor", Url = "http://squidex.io/path/to/editor" } } }; var settings_1 = await _.Apps.PutAppSettingsAsync(_.AppName, updateRequest); Assert.NotEmpty(settings_1.Patterns); Assert.NotEmpty(settings_1.Editors); }
public async Task Should_update_settings() { // STEP 1: Update settings with new state. var updateRequest = new UpdateAppSettingsDto { Patterns = new List <PatternDto> { new PatternDto { Name = "pattern", Regex = ".*" } }, Editors = new List <EditorDto> { new EditorDto { Name = "editor", Url = "http://squidex.io/path/to/editor" } } }; var settings_1 = await _.Apps.PutSettingsAsync(_.AppName, updateRequest); Assert.NotEmpty(settings_1.Patterns); Assert.NotEmpty(settings_1.Editors); }
public async Task <IActionResult> PutAppSettings(string app, [FromBody] UpdateAppSettingsDto request) { var response = await InvokeCommandAsync(request.ToCommand(), x => AppSettingsDto.FromApp(x, Resources)); return(Ok(response)); }