コード例 #1
0
ファイル: AppTests.cs プロジェクト: wilmshurstm/squidex
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: AppsController.cs プロジェクト: wilmshurstm/squidex
        public async Task <IActionResult> PutAppSettings(string app, [FromBody] UpdateAppSettingsDto request)
        {
            var response = await InvokeCommandAsync(request.ToCommand(), x => AppSettingsDto.FromApp(x, Resources));

            return(Ok(response));
        }