From 5066f94ef0cd0bd15dcc0be78e8407796f3a57d9 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Wed, 5 Oct 2022 14:19:21 +0200 Subject: [PATCH] specs,nextcloud: Fix wrong http methods in news and add tests for them --- .../nextcloud/lib/src/nextcloud.openapi.dart | 4 +-- .../nextcloud/lib/src/nextcloud.openapi.json | 4 +-- packages/nextcloud/test/news_test.dart | 29 +++++++++++++++++++ specs/news.json | 4 +-- 4 files changed, 35 insertions(+), 6 deletions(-) diff --git a/packages/nextcloud/lib/src/nextcloud.openapi.dart b/packages/nextcloud/lib/src/nextcloud.openapi.dart index 61601a8c..459ac5ce 100644 --- a/packages/nextcloud/lib/src/nextcloud.openapi.dart +++ b/packages/nextcloud/lib/src/nextcloud.openapi.dart @@ -1870,7 +1870,7 @@ class NewsClient { queryParameters['folderId'] = folderId.toString(); } final response = await rootClient.doRequest( - 'put', + 'post', Uri(path: path, queryParameters: queryParameters).toString(), headers, body, @@ -1892,7 +1892,7 @@ class NewsClient { path = path.replaceAll('{feedId}', Uri.encodeQueryComponent(feedId.toString())); queryParameters['feedTitle'] = feedTitle.toString(); final response = await rootClient.doRequest( - 'put', + 'post', Uri(path: path, queryParameters: queryParameters).toString(), headers, body, diff --git a/packages/nextcloud/lib/src/nextcloud.openapi.json b/packages/nextcloud/lib/src/nextcloud.openapi.json index fd44c979..d772ecdd 100644 --- a/packages/nextcloud/lib/src/nextcloud.openapi.json +++ b/packages/nextcloud/lib/src/nextcloud.openapi.json @@ -2064,7 +2064,7 @@ } } ], - "put": { + "post": { "operationId": "move-feed", "tags": [ "news" @@ -2097,7 +2097,7 @@ } } ], - "put": { + "post": { "operationId": "rename-feed", "tags": [ "news" diff --git a/packages/nextcloud/test/news_test.dart b/packages/nextcloud/test/news_test.dart index 7c153fe5..6e26efc0 100644 --- a/packages/nextcloud/test/news_test.dart +++ b/packages/nextcloud/test/news_test.dart @@ -47,6 +47,35 @@ Future main() async { expect(response.feeds![0].url, wikipediaFeedURL); }); + test('Rename feed', () async { + var response = await addWikipediaFeed(); + expect(response.feeds![0].title, 'Wikipedia featured articles feed'); + + await client.news.renameFeed( + feedId: 1, + feedTitle: 'test1', + ); + + response = await client.news.listFeeds(); + expect(response.feeds![0].title, 'test1'); + }); + + test('Move feed to folder', () async { + await client.news.createFolder(name: 'test1'); + await addWikipediaFeed(); + await client.news.moveFeed( + feedId: 1, + folderId: 1, + ); + + final response = await client.news.listFolders(); + expect(response.folders, hasLength(1)); + expect(response.folders![0].id, 1); + expect(response.folders![0].name, 'test1'); + expect(response.folders![0].opened, true); + expect(response.folders![0].feeds, hasLength(0)); + }); + test('Mark feed as read', () async { final feedsResponse = await addWikipediaFeed(); diff --git a/specs/news.json b/specs/news.json index 95eaca9f..65c912af 100644 --- a/specs/news.json +++ b/specs/news.json @@ -481,7 +481,7 @@ } } ], - "put": { + "post": { "operationId": "move-feed", "tags": [ "news" @@ -514,7 +514,7 @@ } } ], - "put": { + "post": { "operationId": "rename-feed", "tags": [ "news"