Browse Source

test(nextcloud): Test news feed delete and folder rename and delete

Signed-off-by: jld3103 <jld3103yt@gmail.com>
pull/868/head
jld3103 1 year ago
parent
commit
14ea48d7e9
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 58
      packages/nextcloud/test/news_test.dart

58
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<void>());
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<void>());
expect(() => deleteResponse.headers, isA<void>());
response = await client.news.listFeeds();
expect(response.statusCode, 200);
expect(() => response.headers, isA<void>());
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<void>());
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<void>());
expect(() => deleteResponse.headers, isA<void>());
response = await client.news.listFolders();
expect(response.statusCode, 200);
expect(() => response.headers, isA<void>());
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<void>());
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<void>());
expect(() => deleteResponse.headers, isA<void>());
response = await client.news.listFolders();
expect(response.statusCode, 200);
expect(() => response.headers, isA<void>());
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);

Loading…
Cancel
Save