From 14ea48d7e9f4376d4d4137afb70b660887769fa4 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Thu, 28 Sep 2023 23:54:48 +0200 Subject: [PATCH] test(nextcloud): Test news feed delete and folder rename and delete Signed-off-by: jld3103 --- packages/nextcloud/test/news_test.dart | 58 ++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/packages/nextcloud/test/news_test.dart b/packages/nextcloud/test/news_test.dart index 8e54491f..bac182e2 100644 --- a/packages/nextcloud/test/news_test.dart +++ b/packages/nextcloud/test/news_test.dart @@ -69,6 +69,25 @@ void main() { expect(response.body.feeds[0].url, 'http://host.docker.internal:${rssServer.port}/wikipedia.xml'); }); + test('Delete feed', () async { + var response = await addWikipediaFeed(); + expect(response.statusCode, 200); + expect(() => response.headers, isA()); + + expect(response.body.feeds, hasLength(1)); + + final deleteResponse = await client.news.deleteFeed(feedId: response.body.feeds.single.id); + expect(deleteResponse.statusCode, 200); + expect(() => deleteResponse.body, isA()); + expect(() => deleteResponse.headers, isA()); + + response = await client.news.listFeeds(); + expect(response.statusCode, 200); + expect(() => response.headers, isA()); + + expect(response.body.feeds, hasLength(0)); + }); + test('Rename feed', () async { var response = await addWikipediaFeed(); expect(response.statusCode, 200); @@ -307,6 +326,45 @@ void main() { expect(response.body.folders[0].feeds, hasLength(0)); }); + test('Delete folder', () async { + var response = await client.news.createFolder(name: 'test1'); + expect(response.statusCode, 200); + expect(() => response.headers, isA()); + + expect(response.body.folders, hasLength(1)); + + final deleteResponse = await client.news.deleteFolder(folderId: response.body.folders.single.id); + expect(deleteResponse.statusCode, 200); + expect(() => deleteResponse.body, isA()); + expect(() => deleteResponse.headers, isA()); + + response = await client.news.listFolders(); + expect(response.statusCode, 200); + expect(() => response.headers, isA()); + + expect(response.body.folders, hasLength(0)); + }); + + test('Rename folder', () async { + var response = await client.news.createFolder(name: 'test1'); + expect(response.statusCode, 200); + expect(() => response.headers, isA()); + + expect(response.body.folders, hasLength(1)); + + final deleteResponse = await client.news.renameFolder(folderId: response.body.folders.single.id, name: 'test2'); + expect(deleteResponse.statusCode, 200); + expect(() => deleteResponse.body, isA()); + expect(() => deleteResponse.headers, isA()); + + response = await client.news.listFolders(); + expect(response.statusCode, 200); + expect(() => response.headers, isA()); + + expect(response.body.folders, hasLength(1)); + expect(response.body.folders.single.name, 'test2'); + }); + test('List folders', () async { var response = await client.news.listFolders(); expect(response.statusCode, 200);