Browse Source

specs,nextcloud: Fix wrong http methods in news and add tests for them

pull/82/head
jld3103 2 years ago
parent
commit
5066f94ef0
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 4
      packages/nextcloud/lib/src/nextcloud.openapi.dart
  2. 4
      packages/nextcloud/lib/src/nextcloud.openapi.json
  3. 29
      packages/nextcloud/test/news_test.dart
  4. 4
      specs/news.json

4
packages/nextcloud/lib/src/nextcloud.openapi.dart

@ -1870,7 +1870,7 @@ class NewsClient {
queryParameters['folderId'] = folderId.toString(); queryParameters['folderId'] = folderId.toString();
} }
final response = await rootClient.doRequest( final response = await rootClient.doRequest(
'put', 'post',
Uri(path: path, queryParameters: queryParameters).toString(), Uri(path: path, queryParameters: queryParameters).toString(),
headers, headers,
body, body,
@ -1892,7 +1892,7 @@ class NewsClient {
path = path.replaceAll('{feedId}', Uri.encodeQueryComponent(feedId.toString())); path = path.replaceAll('{feedId}', Uri.encodeQueryComponent(feedId.toString()));
queryParameters['feedTitle'] = feedTitle.toString(); queryParameters['feedTitle'] = feedTitle.toString();
final response = await rootClient.doRequest( final response = await rootClient.doRequest(
'put', 'post',
Uri(path: path, queryParameters: queryParameters).toString(), Uri(path: path, queryParameters: queryParameters).toString(),
headers, headers,
body, body,

4
packages/nextcloud/lib/src/nextcloud.openapi.json

@ -2064,7 +2064,7 @@
} }
} }
], ],
"put": { "post": {
"operationId": "move-feed", "operationId": "move-feed",
"tags": [ "tags": [
"news" "news"
@ -2097,7 +2097,7 @@
} }
} }
], ],
"put": { "post": {
"operationId": "rename-feed", "operationId": "rename-feed",
"tags": [ "tags": [
"news" "news"

29
packages/nextcloud/test/news_test.dart

@ -47,6 +47,35 @@ Future main() async {
expect(response.feeds![0].url, wikipediaFeedURL); 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 { test('Mark feed as read', () async {
final feedsResponse = await addWikipediaFeed(); final feedsResponse = await addWikipediaFeed();

4
specs/news.json

@ -481,7 +481,7 @@
} }
} }
], ],
"put": { "post": {
"operationId": "move-feed", "operationId": "move-feed",
"tags": [ "tags": [
"news" "news"
@ -514,7 +514,7 @@
} }
} }
], ],
"put": { "post": {
"operationId": "rename-feed", "operationId": "rename-feed",
"tags": [ "tags": [
"news" "news"

Loading…
Cancel
Save