Browse Source
Signed-off-by: Nikolas Rimikis <rimikis.nikolas@gmail.com> Signed-off-by: Nikolas Rimikis <leptopoda@users.noreply.github.com>pull/603/head
Nikolas Rimikis
1 year ago
committed by
Nikolas Rimikis
9 changed files with 1310 additions and 1284 deletions
@ -1,160 +1,162 @@
|
||||
@Retry(3) |
||||
library core_test; |
||||
|
||||
import 'package:nextcloud/nextcloud.dart'; |
||||
import 'package:test/test.dart'; |
||||
|
||||
import 'helper.dart'; |
||||
|
||||
void main() { |
||||
group('core', () { |
||||
late DockerImage image; |
||||
setUpAll(() async => image = await getDockerImage()); |
||||
|
||||
late DockerContainer container; |
||||
late TestNextcloudClient client; |
||||
setUp(() async { |
||||
container = await getDockerContainer(image); |
||||
client = await getTestClient(container); |
||||
}); |
||||
tearDown(() => container.destroy()); |
||||
|
||||
test('Is supported from capabilities', () async { |
||||
final (supported, _) = client.core.isSupported((await client.core.ocs.getCapabilities()).ocs.data); |
||||
expect(supported, isTrue); |
||||
}); |
||||
|
||||
test('Is supported from status', () async { |
||||
final status = await client.core.getStatus(); |
||||
expect(status.isSupported, isTrue); |
||||
}); |
||||
|
||||
test('Get status', () async { |
||||
final status = await client.core.getStatus(); |
||||
expect(status.installed, true); |
||||
expect(status.maintenance, false); |
||||
expect(status.needsDbUpgrade, false); |
||||
expect(status.version, startsWith('$coreSupportedVersion.')); |
||||
expect(status.versionstring, startsWith('$coreSupportedVersion.')); |
||||
expect(status.edition, ''); |
||||
expect(status.productname, 'Nextcloud'); |
||||
expect(status.extendedSupport, false); |
||||
}); |
||||
|
||||
test('Get capabilities', () async { |
||||
final capabilities = await client.core.ocs.getCapabilities(); |
||||
expect(capabilities.ocs.data.version.major, coreSupportedVersion); |
||||
expect(capabilities.ocs.data.version.string, startsWith('$coreSupportedVersion.')); |
||||
expect(capabilities.ocs.data.capabilities.commentsCapabilities, isNotNull); |
||||
expect(capabilities.ocs.data.capabilities.davCapabilities, isNotNull); |
||||
expect(capabilities.ocs.data.capabilities.filesCapabilities, isNotNull); |
||||
expect(capabilities.ocs.data.capabilities.filesSharingCapabilities, isNotNull); |
||||
expect(capabilities.ocs.data.capabilities.filesTrashbinCapabilities, isNotNull); |
||||
expect(capabilities.ocs.data.capabilities.filesVersionsCapabilities, isNotNull); |
||||
expect(capabilities.ocs.data.capabilities.notesCapabilities, isNotNull); |
||||
expect(capabilities.ocs.data.capabilities.notificationsCapabilities, isNotNull); |
||||
expect(capabilities.ocs.data.capabilities.provisioningApiCapabilities, isNotNull); |
||||
expect(capabilities.ocs.data.capabilities.sharebymailCapabilities, isNotNull); |
||||
expect(capabilities.ocs.data.capabilities.themingPublicCapabilities, isNotNull); |
||||
expect(capabilities.ocs.data.capabilities.userStatusCapabilities, isNotNull); |
||||
expect(capabilities.ocs.data.capabilities.weatherStatusCapabilities, isNotNull); |
||||
}); |
||||
|
||||
test('Get navigation apps', () async { |
||||
final navigationApps = await client.core.navigation.getAppsNavigation(); |
||||
expect(navigationApps.ocs.data, hasLength(6)); |
||||
expect(navigationApps.ocs.data[0].id, 'dashboard'); |
||||
expect(navigationApps.ocs.data[1].id, 'files'); |
||||
expect(navigationApps.ocs.data[2].id, 'photos'); |
||||
expect(navigationApps.ocs.data[3].id, 'activity'); |
||||
expect(navigationApps.ocs.data[4].id, 'notes'); |
||||
expect(navigationApps.ocs.data[5].id, 'news'); |
||||
}); |
||||
|
||||
test( |
||||
'Autocomplete', |
||||
() async { |
||||
final response = await client.core.autoComplete.$get( |
||||
search: '', |
||||
itemType: 'call', |
||||
itemId: 'new', |
||||
shareTypes: [ |
||||
ShareType.user.index, |
||||
ShareType.group.index, |
||||
], |
||||
); |
||||
expect(response.ocs.data, hasLength(3)); |
||||
|
||||
expect(response.ocs.data[0].id, 'admin'); |
||||
expect(response.ocs.data[0].label, 'admin'); |
||||
expect(response.ocs.data[0].icon, 'icon-user'); |
||||
expect(response.ocs.data[0].source, 'users'); |
||||
expect(response.ocs.data[0].status, isEmpty); |
||||
expect(response.ocs.data[0].subline, ''); |
||||
expect(response.ocs.data[0].shareWithDisplayNameUnique, 'admin@example.com'); |
||||
|
||||
expect(response.ocs.data[1].id, 'user2'); |
||||
expect(response.ocs.data[1].label, 'User Two'); |
||||
expect(response.ocs.data[1].icon, 'icon-user'); |
||||
expect(response.ocs.data[1].source, 'users'); |
||||
expect(response.ocs.data[1].status, isEmpty); |
||||
expect(response.ocs.data[1].subline, ''); |
||||
expect(response.ocs.data[1].shareWithDisplayNameUnique, 'user2'); |
||||
|
||||
expect(response.ocs.data[2].id, 'admin'); |
||||
expect(response.ocs.data[2].label, 'admin'); |
||||
expect(response.ocs.data[2].icon, ''); |
||||
expect(response.ocs.data[2].source, 'groups'); |
||||
expect(response.ocs.data[2].status, isEmpty); |
||||
expect(response.ocs.data[2].subline, ''); |
||||
expect(response.ocs.data[2].shareWithDisplayNameUnique, ''); |
||||
}, |
||||
skip: true, // TODO: This test only works on 28+ due to a bug fix with the status |
||||
); |
||||
|
||||
test('Get preview', () async { |
||||
final response = await client.core.preview.getPreview(file: 'Nextcloud.png'); |
||||
expect(response, isNotEmpty); |
||||
}); |
||||
|
||||
test('Get avatar', () async { |
||||
final response = await client.core.avatar.getAvatar(userId: 'admin', size: 32); |
||||
expect(response.data, isNotEmpty); |
||||
}); |
||||
|
||||
test('Get dark avatar', () async { |
||||
final response = await client.core.avatar.getAvatarDark(userId: 'admin', size: 32); |
||||
expect(response.data, isNotEmpty); |
||||
}); |
||||
|
||||
test('Delete app password', () async { |
||||
await client.core.appPassword.deleteAppPassword(); |
||||
expect( |
||||
() => client.core.appPassword.deleteAppPassword(), |
||||
throwsA(predicate((final e) => (e! as DynamiteApiException).statusCode == 401)), |
||||
group( |
||||
'core', |
||||
() { |
||||
late DockerImage image; |
||||
setUpAll(() async => image = await getDockerImage()); |
||||
|
||||
late DockerContainer container; |
||||
late TestNextcloudClient client; |
||||
setUp(() async { |
||||
container = await getDockerContainer(image); |
||||
client = await getTestClient(container); |
||||
}); |
||||
tearDown(() => container.destroy()); |
||||
|
||||
test('Is supported from capabilities', () async { |
||||
final (supported, _) = client.core.isSupported((await client.core.ocs.getCapabilities()).ocs.data); |
||||
expect(supported, isTrue); |
||||
}); |
||||
|
||||
test('Is supported from status', () async { |
||||
final status = await client.core.getStatus(); |
||||
expect(status.isSupported, isTrue); |
||||
}); |
||||
|
||||
test('Get status', () async { |
||||
final status = await client.core.getStatus(); |
||||
expect(status.installed, true); |
||||
expect(status.maintenance, false); |
||||
expect(status.needsDbUpgrade, false); |
||||
expect(status.version, startsWith('$coreSupportedVersion.')); |
||||
expect(status.versionstring, startsWith('$coreSupportedVersion.')); |
||||
expect(status.edition, ''); |
||||
expect(status.productname, 'Nextcloud'); |
||||
expect(status.extendedSupport, false); |
||||
}); |
||||
|
||||
test('Get capabilities', () async { |
||||
final capabilities = await client.core.ocs.getCapabilities(); |
||||
expect(capabilities.ocs.data.version.major, coreSupportedVersion); |
||||
expect(capabilities.ocs.data.version.string, startsWith('$coreSupportedVersion.')); |
||||
expect(capabilities.ocs.data.capabilities.commentsCapabilities, isNotNull); |
||||
expect(capabilities.ocs.data.capabilities.davCapabilities, isNotNull); |
||||
expect(capabilities.ocs.data.capabilities.filesCapabilities, isNotNull); |
||||
expect(capabilities.ocs.data.capabilities.filesSharingCapabilities, isNotNull); |
||||
expect(capabilities.ocs.data.capabilities.filesTrashbinCapabilities, isNotNull); |
||||
expect(capabilities.ocs.data.capabilities.filesVersionsCapabilities, isNotNull); |
||||
expect(capabilities.ocs.data.capabilities.notesCapabilities, isNotNull); |
||||
expect(capabilities.ocs.data.capabilities.notificationsCapabilities, isNotNull); |
||||
expect(capabilities.ocs.data.capabilities.provisioningApiCapabilities, isNotNull); |
||||
expect(capabilities.ocs.data.capabilities.sharebymailCapabilities, isNotNull); |
||||
expect(capabilities.ocs.data.capabilities.themingPublicCapabilities, isNotNull); |
||||
expect(capabilities.ocs.data.capabilities.userStatusCapabilities, isNotNull); |
||||
expect(capabilities.ocs.data.capabilities.weatherStatusCapabilities, isNotNull); |
||||
}); |
||||
|
||||
test('Get navigation apps', () async { |
||||
final navigationApps = await client.core.navigation.getAppsNavigation(); |
||||
expect(navigationApps.ocs.data, hasLength(6)); |
||||
expect(navigationApps.ocs.data[0].id, 'dashboard'); |
||||
expect(navigationApps.ocs.data[1].id, 'files'); |
||||
expect(navigationApps.ocs.data[2].id, 'photos'); |
||||
expect(navigationApps.ocs.data[3].id, 'activity'); |
||||
expect(navigationApps.ocs.data[4].id, 'notes'); |
||||
expect(navigationApps.ocs.data[5].id, 'news'); |
||||
}); |
||||
|
||||
test( |
||||
'Autocomplete', |
||||
() async { |
||||
final response = await client.core.autoComplete.$get( |
||||
search: '', |
||||
itemType: 'call', |
||||
itemId: 'new', |
||||
shareTypes: [ |
||||
ShareType.user.index, |
||||
ShareType.group.index, |
||||
], |
||||
); |
||||
expect(response.ocs.data, hasLength(3)); |
||||
|
||||
expect(response.ocs.data[0].id, 'admin'); |
||||
expect(response.ocs.data[0].label, 'admin'); |
||||
expect(response.ocs.data[0].icon, 'icon-user'); |
||||
expect(response.ocs.data[0].source, 'users'); |
||||
expect(response.ocs.data[0].status, isEmpty); |
||||
expect(response.ocs.data[0].subline, ''); |
||||
expect(response.ocs.data[0].shareWithDisplayNameUnique, 'admin@example.com'); |
||||
|
||||
expect(response.ocs.data[1].id, 'user2'); |
||||
expect(response.ocs.data[1].label, 'User Two'); |
||||
expect(response.ocs.data[1].icon, 'icon-user'); |
||||
expect(response.ocs.data[1].source, 'users'); |
||||
expect(response.ocs.data[1].status, isEmpty); |
||||
expect(response.ocs.data[1].subline, ''); |
||||
expect(response.ocs.data[1].shareWithDisplayNameUnique, 'user2'); |
||||
|
||||
expect(response.ocs.data[2].id, 'admin'); |
||||
expect(response.ocs.data[2].label, 'admin'); |
||||
expect(response.ocs.data[2].icon, ''); |
||||
expect(response.ocs.data[2].source, 'groups'); |
||||
expect(response.ocs.data[2].status, isEmpty); |
||||
expect(response.ocs.data[2].subline, ''); |
||||
expect(response.ocs.data[2].shareWithDisplayNameUnique, ''); |
||||
}, |
||||
skip: true, // TODO: This test only works on 28+ due to a bug fix with the status |
||||
); |
||||
}); |
||||
|
||||
test('Unified search providers', () async { |
||||
final response = await client.core.unifiedSearch.getProviders(); |
||||
expect(response.ocs.data, hasLength(13)); |
||||
}); |
||||
test('Get preview', () async { |
||||
final response = await client.core.preview.getPreview(file: 'Nextcloud.png'); |
||||
expect(response, isNotEmpty); |
||||
}); |
||||
|
||||
test('Get avatar', () async { |
||||
final response = await client.core.avatar.getAvatar(userId: 'admin', size: 32); |
||||
expect(response.data, isNotEmpty); |
||||
}); |
||||
|
||||
test('Get dark avatar', () async { |
||||
final response = await client.core.avatar.getAvatarDark(userId: 'admin', size: 32); |
||||
expect(response.data, isNotEmpty); |
||||
}); |
||||
|
||||
test('Delete app password', () async { |
||||
await client.core.appPassword.deleteAppPassword(); |
||||
expect( |
||||
() => client.core.appPassword.deleteAppPassword(), |
||||
throwsA(predicate((final e) => (e! as DynamiteApiException).statusCode == 401)), |
||||
); |
||||
}); |
||||
|
||||
test('Unified search providers', () async { |
||||
final response = await client.core.unifiedSearch.getProviders(); |
||||
expect(response.ocs.data, hasLength(13)); |
||||
}); |
||||
|
||||
test('Unified search', () async { |
||||
final response = await client.core.unifiedSearch.search( |
||||
providerId: 'settings', |
||||
term: 'Personal info', |
||||
); |
||||
expect(response.ocs.data.name, 'Settings'); |
||||
expect(response.ocs.data.isPaginated, isFalse); |
||||
expect(response.ocs.data.entries, hasLength(1)); |
||||
expect(response.ocs.data.entries.single.thumbnailUrl, isEmpty); |
||||
expect(response.ocs.data.entries.single.title, 'Personal info'); |
||||
expect(response.ocs.data.entries.single.subline, isEmpty); |
||||
expect(response.ocs.data.entries.single.resourceUrl, isNotEmpty); |
||||
expect(response.ocs.data.entries.single.icon, 'icon-settings-dark'); |
||||
expect(response.ocs.data.entries.single.rounded, isFalse); |
||||
expect(response.ocs.data.entries.single.attributes, isEmpty); |
||||
}); |
||||
}); |
||||
test('Unified search', () async { |
||||
final response = await client.core.unifiedSearch.search( |
||||
providerId: 'settings', |
||||
term: 'Personal info', |
||||
); |
||||
expect(response.ocs.data.name, 'Settings'); |
||||
expect(response.ocs.data.isPaginated, isFalse); |
||||
expect(response.ocs.data.entries, hasLength(1)); |
||||
expect(response.ocs.data.entries.single.thumbnailUrl, isEmpty); |
||||
expect(response.ocs.data.entries.single.title, 'Personal info'); |
||||
expect(response.ocs.data.entries.single.subline, isEmpty); |
||||
expect(response.ocs.data.entries.single.resourceUrl, isNotEmpty); |
||||
expect(response.ocs.data.entries.single.icon, 'icon-settings-dark'); |
||||
expect(response.ocs.data.entries.single.rounded, isFalse); |
||||
expect(response.ocs.data.entries.single.attributes, isEmpty); |
||||
}); |
||||
}, |
||||
retry: retryCount, |
||||
timeout: timeout, |
||||
); |
||||
} |
||||
|
@ -1,143 +1,145 @@
|
||||
@Retry(3) |
||||
library notes_test; |
||||
|
||||
import 'package:nextcloud/nextcloud.dart'; |
||||
import 'package:test/test.dart'; |
||||
|
||||
import 'helper.dart'; |
||||
|
||||
void main() { |
||||
group('notes', () { |
||||
late DockerImage image; |
||||
setUpAll(() async => image = await getDockerImage()); |
||||
|
||||
late DockerContainer container; |
||||
late TestNextcloudClient client; |
||||
setUp(() async { |
||||
container = await getDockerContainer(image); |
||||
client = await getTestClient(container); |
||||
}); |
||||
tearDown(() => container.destroy()); |
||||
|
||||
test('Is supported', () async { |
||||
final (supported, _) = client.notes.isSupported((await client.core.ocs.getCapabilities()).ocs.data); |
||||
expect(supported, isTrue); |
||||
}); |
||||
|
||||
test('Create note favorite', () async { |
||||
final response = await client.notes.createNote( |
||||
title: 'a', |
||||
content: 'b', |
||||
category: 'c', |
||||
favorite: 1, |
||||
); |
||||
expect(response.id, isPositive); |
||||
expect(response.title, 'a'); |
||||
expect(response.content, 'b'); |
||||
expect(response.category, 'c'); |
||||
expect(response.favorite, true); |
||||
expect(response.readonly, false); |
||||
expect(response.etag, isNotNull); |
||||
expect(response.modified, isNotNull); |
||||
}); |
||||
|
||||
test('Create note not favorite', () async { |
||||
final response = await client.notes.createNote( |
||||
title: 'a', |
||||
content: 'b', |
||||
category: 'c', |
||||
); |
||||
expect(response.id, isPositive); |
||||
expect(response.title, 'a'); |
||||
expect(response.content, 'b'); |
||||
expect(response.category, 'c'); |
||||
expect(response.favorite, false); |
||||
expect(response.readonly, false); |
||||
expect(response.etag, isNotNull); |
||||
expect(response.modified, isNotNull); |
||||
}); |
||||
|
||||
test('Get notes', () async { |
||||
await client.notes.createNote(title: 'a'); |
||||
await client.notes.createNote(title: 'b'); |
||||
|
||||
final response = await client.notes.getNotes(); |
||||
expect(response, hasLength(2)); |
||||
expect(response[0].title, 'a'); |
||||
expect(response[1].title, 'b'); |
||||
}); |
||||
|
||||
test('Get note', () async { |
||||
final response = await client.notes.getNote( |
||||
id: (await client.notes.createNote(title: 'a')).id, |
||||
); |
||||
expect(response.title, 'a'); |
||||
}); |
||||
|
||||
test('Update note', () async { |
||||
final id = (await client.notes.createNote(title: 'a')).id; |
||||
await client.notes.updateNote( |
||||
id: id, |
||||
title: 'b', |
||||
); |
||||
|
||||
final response = await client.notes.getNote(id: id); |
||||
expect(response.title, 'b'); |
||||
}); |
||||
|
||||
test('Update note fail changed on server', () async { |
||||
final response = await client.notes.createNote(title: 'a'); |
||||
await client.notes.updateNote( |
||||
id: response.id, |
||||
title: 'b', |
||||
ifMatch: '"${response.etag}"', |
||||
); |
||||
expect( |
||||
() => client.notes.updateNote( |
||||
group( |
||||
'notes', |
||||
() { |
||||
late DockerImage image; |
||||
setUpAll(() async => image = await getDockerImage()); |
||||
|
||||
late DockerContainer container; |
||||
late TestNextcloudClient client; |
||||
setUp(() async { |
||||
container = await getDockerContainer(image); |
||||
client = await getTestClient(container); |
||||
}); |
||||
tearDown(() => container.destroy()); |
||||
|
||||
test('Is supported', () async { |
||||
final (supported, _) = client.notes.isSupported((await client.core.ocs.getCapabilities()).ocs.data); |
||||
expect(supported, isTrue); |
||||
}); |
||||
|
||||
test('Create note favorite', () async { |
||||
final response = await client.notes.createNote( |
||||
title: 'a', |
||||
content: 'b', |
||||
category: 'c', |
||||
favorite: 1, |
||||
); |
||||
expect(response.id, isPositive); |
||||
expect(response.title, 'a'); |
||||
expect(response.content, 'b'); |
||||
expect(response.category, 'c'); |
||||
expect(response.favorite, true); |
||||
expect(response.readonly, false); |
||||
expect(response.etag, isNotNull); |
||||
expect(response.modified, isNotNull); |
||||
}); |
||||
|
||||
test('Create note not favorite', () async { |
||||
final response = await client.notes.createNote( |
||||
title: 'a', |
||||
content: 'b', |
||||
category: 'c', |
||||
); |
||||
expect(response.id, isPositive); |
||||
expect(response.title, 'a'); |
||||
expect(response.content, 'b'); |
||||
expect(response.category, 'c'); |
||||
expect(response.favorite, false); |
||||
expect(response.readonly, false); |
||||
expect(response.etag, isNotNull); |
||||
expect(response.modified, isNotNull); |
||||
}); |
||||
|
||||
test('Get notes', () async { |
||||
await client.notes.createNote(title: 'a'); |
||||
await client.notes.createNote(title: 'b'); |
||||
|
||||
final response = await client.notes.getNotes(); |
||||
expect(response, hasLength(2)); |
||||
expect(response[0].title, 'a'); |
||||
expect(response[1].title, 'b'); |
||||
}); |
||||
|
||||
test('Get note', () async { |
||||
final response = await client.notes.getNote( |
||||
id: (await client.notes.createNote(title: 'a')).id, |
||||
); |
||||
expect(response.title, 'a'); |
||||
}); |
||||
|
||||
test('Update note', () async { |
||||
final id = (await client.notes.createNote(title: 'a')).id; |
||||
await client.notes.updateNote( |
||||
id: id, |
||||
title: 'b', |
||||
); |
||||
|
||||
final response = await client.notes.getNote(id: id); |
||||
expect(response.title, 'b'); |
||||
}); |
||||
|
||||
test('Update note fail changed on server', () async { |
||||
final response = await client.notes.createNote(title: 'a'); |
||||
await client.notes.updateNote( |
||||
id: response.id, |
||||
title: 'c', |
||||
title: 'b', |
||||
ifMatch: '"${response.etag}"', |
||||
), |
||||
throwsA(predicate((final e) => (e! as DynamiteApiException).statusCode == 412)), |
||||
); |
||||
}); |
||||
|
||||
test('Delete note', () async { |
||||
final id = (await client.notes.createNote(title: 'a')).id; |
||||
|
||||
var response = await client.notes.getNotes(); |
||||
expect(response, hasLength(1)); |
||||
|
||||
await client.notes.deleteNote(id: id); |
||||
|
||||
response = await client.notes.getNotes(); |
||||
expect(response, hasLength(0)); |
||||
}); |
||||
|
||||
test('Get settings', () async { |
||||
final response = await client.notes.getSettings(); |
||||
expect(response.notesPath, 'Notes'); |
||||
expect(response.fileSuffix, '.md'); |
||||
expect(response.noteMode, NotesSettings_NoteMode.rich); |
||||
}); |
||||
|
||||
test('Update settings', () async { |
||||
var response = await client.notes.updateSettings( |
||||
settings: NotesSettings( |
||||
(final b) => b |
||||
..notesPath = 'Test Notes' |
||||
..fileSuffix = '.txt' |
||||
..noteMode = NotesSettings_NoteMode.preview, |
||||
), |
||||
); |
||||
expect(response.notesPath, 'Test Notes'); |
||||
expect(response.fileSuffix, '.txt'); |
||||
expect(response.noteMode, NotesSettings_NoteMode.preview); |
||||
|
||||
response = await client.notes.getSettings(); |
||||
expect(response.notesPath, 'Test Notes'); |
||||
expect(response.fileSuffix, '.txt'); |
||||
expect(response.noteMode, NotesSettings_NoteMode.preview); |
||||
}); |
||||
}); |
||||
); |
||||
expect( |
||||
() => client.notes.updateNote( |
||||
id: response.id, |
||||
title: 'c', |
||||
ifMatch: '"${response.etag}"', |
||||
), |
||||
throwsA(predicate((final e) => (e! as DynamiteApiException).statusCode == 412)), |
||||
); |
||||
}); |
||||
|
||||
test('Delete note', () async { |
||||
final id = (await client.notes.createNote(title: 'a')).id; |
||||
|
||||
var response = await client.notes.getNotes(); |
||||
expect(response, hasLength(1)); |
||||
|
||||
await client.notes.deleteNote(id: id); |
||||
|
||||
response = await client.notes.getNotes(); |
||||
expect(response, hasLength(0)); |
||||
}); |
||||
|
||||
test('Get settings', () async { |
||||
final response = await client.notes.getSettings(); |
||||
expect(response.notesPath, 'Notes'); |
||||
expect(response.fileSuffix, '.md'); |
||||
expect(response.noteMode, NotesSettings_NoteMode.rich); |
||||
}); |
||||
|
||||
test('Update settings', () async { |
||||
var response = await client.notes.updateSettings( |
||||
settings: NotesSettings( |
||||
(final b) => b |
||||
..notesPath = 'Test Notes' |
||||
..fileSuffix = '.txt' |
||||
..noteMode = NotesSettings_NoteMode.preview, |
||||
), |
||||
); |
||||
expect(response.notesPath, 'Test Notes'); |
||||
expect(response.fileSuffix, '.txt'); |
||||
expect(response.noteMode, NotesSettings_NoteMode.preview); |
||||
|
||||
response = await client.notes.getSettings(); |
||||
expect(response.notesPath, 'Test Notes'); |
||||
expect(response.fileSuffix, '.txt'); |
||||
expect(response.noteMode, NotesSettings_NoteMode.preview); |
||||
}); |
||||
}, |
||||
retry: retryCount, |
||||
timeout: timeout, |
||||
); |
||||
} |
||||
|
@ -1,54 +1,56 @@
|
||||
@Retry(3) |
||||
library provisioning_api_test; |
||||
|
||||
import 'package:test/test.dart'; |
||||
|
||||
import 'helper.dart'; |
||||
|
||||
void main() { |
||||
group('provisioning_api', () { |
||||
late DockerImage image; |
||||
setUpAll(() async => image = await getDockerImage()); |
||||
|
||||
late DockerContainer container; |
||||
late TestNextcloudClient client; |
||||
setUp(() async { |
||||
container = await getDockerContainer(image); |
||||
client = await getTestClient( |
||||
container, |
||||
username: 'admin', |
||||
); |
||||
}); |
||||
tearDown(() => container.destroy()); |
||||
|
||||
group('Users', () { |
||||
test('Get current user', () async { |
||||
final user = await client.provisioningApi.users.getCurrentUser(); |
||||
expect(user.ocs.data.id, 'admin'); |
||||
expect(user.ocs.data.displayName, 'admin'); |
||||
expect(user.ocs.data.displaynameScope, 'v2-federated'); |
||||
expect(user.ocs.data.language, 'en'); |
||||
group( |
||||
'provisioning_api', |
||||
() { |
||||
late DockerImage image; |
||||
setUpAll(() async => image = await getDockerImage()); |
||||
|
||||
late DockerContainer container; |
||||
late TestNextcloudClient client; |
||||
setUp(() async { |
||||
container = await getDockerContainer(image); |
||||
client = await getTestClient( |
||||
container, |
||||
username: 'admin', |
||||
); |
||||
}); |
||||
|
||||
test('Get user by username', () async { |
||||
final user = await client.provisioningApi.users.getUser(userId: 'user1'); |
||||
expect(user.ocs.data.id, 'user1'); |
||||
expect(user.ocs.data.displayname, 'User One'); |
||||
expect(user.ocs.data.displaynameScope, null); |
||||
expect(user.ocs.data.language, 'en'); |
||||
tearDown(() => container.destroy()); |
||||
|
||||
group('Users', () { |
||||
test('Get current user', () async { |
||||
final user = await client.provisioningApi.users.getCurrentUser(); |
||||
expect(user.ocs.data.id, 'admin'); |
||||
expect(user.ocs.data.displayName, 'admin'); |
||||
expect(user.ocs.data.displaynameScope, 'v2-federated'); |
||||
expect(user.ocs.data.language, 'en'); |
||||
}); |
||||
|
||||
test('Get user by username', () async { |
||||
final user = await client.provisioningApi.users.getUser(userId: 'user1'); |
||||
expect(user.ocs.data.id, 'user1'); |
||||
expect(user.ocs.data.displayname, 'User One'); |
||||
expect(user.ocs.data.displaynameScope, null); |
||||
expect(user.ocs.data.language, 'en'); |
||||
}); |
||||
}); |
||||
}); |
||||
|
||||
group('Apps', () { |
||||
test('Get apps', () async { |
||||
final response = await client.provisioningApi.apps.getApps(); |
||||
expect(response.ocs.data.apps, hasLength(39)); |
||||
group('Apps', () { |
||||
test('Get apps', () async { |
||||
final response = await client.provisioningApi.apps.getApps(); |
||||
expect(response.ocs.data.apps, hasLength(39)); |
||||
|
||||
for (final id in response.ocs.data.apps) { |
||||
final app = await client.provisioningApi.apps.getAppInfo(app: id); |
||||
expect(app.ocs.data.id, isNotEmpty); |
||||
} |
||||
for (final id in response.ocs.data.apps) { |
||||
final app = await client.provisioningApi.apps.getAppInfo(app: id); |
||||
expect(app.ocs.data.id, isNotEmpty); |
||||
} |
||||
}); |
||||
}); |
||||
}); |
||||
}); |
||||
}, |
||||
retry: retryCount, |
||||
timeout: timeout, |
||||
); |
||||
} |
||||
|
@ -1,67 +1,69 @@
|
||||
@Retry(3) |
||||
library uppush_test; |
||||
|
||||
import 'package:test/test.dart'; |
||||
|
||||
import 'helper.dart'; |
||||
|
||||
void main() { |
||||
group('uppush', () { |
||||
late DockerImage image; |
||||
setUpAll(() async => image = await getDockerImage()); |
||||
group( |
||||
'uppush', |
||||
() { |
||||
late DockerImage image; |
||||
setUpAll(() async => image = await getDockerImage()); |
||||
|
||||
late DockerContainer container; |
||||
late TestNextcloudClient client; |
||||
setUp(() async { |
||||
container = await getDockerContainer(image); |
||||
client = await getTestClient( |
||||
container, |
||||
username: 'admin', |
||||
); |
||||
}); |
||||
tearDown(() => container.destroy()); |
||||
late DockerContainer container; |
||||
late TestNextcloudClient client; |
||||
setUp(() async { |
||||
container = await getDockerContainer(image); |
||||
client = await getTestClient( |
||||
container, |
||||
username: 'admin', |
||||
); |
||||
}); |
||||
tearDown(() => container.destroy()); |
||||
|
||||
test('Is installed', () async { |
||||
final response = await client.uppush.check(); |
||||
expect(response.success, isTrue); |
||||
}); |
||||
test('Is installed', () async { |
||||
final response = await client.uppush.check(); |
||||
expect(response.success, isTrue); |
||||
}); |
||||
|
||||
test('Set keepalive', () async { |
||||
final response = await client.uppush.setKeepalive(keepalive: 10); |
||||
expect(response.success, isTrue); |
||||
}); |
||||
test('Set keepalive', () async { |
||||
final response = await client.uppush.setKeepalive(keepalive: 10); |
||||
expect(response.success, isTrue); |
||||
}); |
||||
|
||||
test('Create device', () async { |
||||
final response = await client.uppush.createDevice(deviceName: 'Test'); |
||||
expect(response.success, isTrue); |
||||
expect(response.deviceId, isNotEmpty); |
||||
}); |
||||
test('Create device', () async { |
||||
final response = await client.uppush.createDevice(deviceName: 'Test'); |
||||
expect(response.success, isTrue); |
||||
expect(response.deviceId, isNotEmpty); |
||||
}); |
||||
|
||||
test('Delete device', () async { |
||||
final deviceId = (await client.uppush.createDevice(deviceName: 'Test')).deviceId; |
||||
test('Delete device', () async { |
||||
final deviceId = (await client.uppush.createDevice(deviceName: 'Test')).deviceId; |
||||
|
||||
final response = await client.uppush.deleteDevice(deviceId: deviceId); |
||||
expect(response.success, isTrue); |
||||
}); |
||||
final response = await client.uppush.deleteDevice(deviceId: deviceId); |
||||
expect(response.success, isTrue); |
||||
}); |
||||
|
||||
test('Create app', () async { |
||||
final deviceId = (await client.uppush.createDevice(deviceName: 'Test')).deviceId; |
||||
test('Create app', () async { |
||||
final deviceId = (await client.uppush.createDevice(deviceName: 'Test')).deviceId; |
||||
|
||||
final response = await client.uppush.createApp(deviceId: deviceId, appName: 'Test'); |
||||
expect(response.success, isTrue); |
||||
expect(response.token, isNotEmpty); |
||||
}); |
||||
final response = await client.uppush.createApp(deviceId: deviceId, appName: 'Test'); |
||||
expect(response.success, isTrue); |
||||
expect(response.token, isNotEmpty); |
||||
}); |
||||
|
||||
test('UnifiedPush discovery', () async { |
||||
final response = await client.uppush.unifiedpushDiscovery(token: 'example'); |
||||
expect(response.unifiedpush.version, 1); |
||||
}); |
||||
test('UnifiedPush discovery', () async { |
||||
final response = await client.uppush.unifiedpushDiscovery(token: 'example'); |
||||
expect(response.unifiedpush.version, 1); |
||||
}); |
||||
|
||||
test('Matrix gateway discovery', () async { |
||||
final response = await client.uppush.gatewayMatrixDiscovery(); |
||||
expect(response.unifiedpush.gateway, 'matrix'); |
||||
}); |
||||
test('Matrix gateway discovery', () async { |
||||
final response = await client.uppush.gatewayMatrixDiscovery(); |
||||
expect(response.unifiedpush.gateway, 'matrix'); |
||||
}); |
||||
|
||||
// Deleting an app, sending a notification (also via matrix gateway) or listening for notifications is not possible because redis is not set up |
||||
}); |
||||
// Deleting an app, sending a notification (also via matrix gateway) or listening for notifications is not possible because redis is not set up |
||||
}, |
||||
retry: retryCount, |
||||
timeout: timeout, |
||||
); |
||||
} |
||||
|
@ -1,174 +1,176 @@
|
||||
@Retry(3) |
||||
library user_status_test; |
||||
|
||||
import 'package:nextcloud/nextcloud.dart'; |
||||
import 'package:test/test.dart'; |
||||
|
||||
import 'helper.dart'; |
||||
|
||||
void main() { |
||||
group('user_status', () { |
||||
late DockerImage image; |
||||
setUpAll(() async => image = await getDockerImage()); |
||||
|
||||
late DockerContainer container; |
||||
late TestNextcloudClient client; |
||||
setUp(() async { |
||||
container = await getDockerContainer(image); |
||||
client = await getTestClient(container); |
||||
}); |
||||
tearDown(() => container.destroy()); |
||||
|
||||
test('Find all predefined statuses', () async { |
||||
final expectedStatusIDs = ['meeting', 'commuting', 'remote-work', 'sick-leave', 'vacationing']; |
||||
final response = await client.userStatus.predefinedStatus.findAll(); |
||||
expect(response.ocs.data, hasLength(5)); |
||||
final responseIDs = response.ocs.data.map((final status) => status.id); |
||||
expect(expectedStatusIDs.map(responseIDs.contains).contains(false), false); |
||||
for (final status in response.ocs.data) { |
||||
expect(status.icon, isNotNull); |
||||
expect(status.message, isNotNull); |
||||
} |
||||
|
||||
final meeting = response.ocs.data.singleWhere((final s) => s.id == 'meeting').clearAt!; |
||||
expect(meeting.type, UserStatusClearAt_Type.period); |
||||
expect(meeting.time.$int, 3600); |
||||
|
||||
final commuting = response.ocs.data.singleWhere((final s) => s.id == 'commuting').clearAt!; |
||||
expect(commuting.type, UserStatusClearAt_Type.period); |
||||
expect(commuting.time.$int, 1800); |
||||
|
||||
final remoteWork = response.ocs.data.singleWhere((final s) => s.id == 'remote-work').clearAt!; |
||||
expect(remoteWork.type, UserStatusClearAt_Type.endOf); |
||||
expect(remoteWork.time.clearAtTimeType, UserStatusClearAtTimeType.day); |
||||
|
||||
final sickLeave = response.ocs.data.singleWhere((final s) => s.id == 'sick-leave').clearAt!; |
||||
expect(sickLeave.type, UserStatusClearAt_Type.endOf); |
||||
expect(sickLeave.time.clearAtTimeType, UserStatusClearAtTimeType.day); |
||||
|
||||
final vacationing = response.ocs.data.singleWhere((final s) => s.id == 'vacationing').clearAt; |
||||
expect(vacationing, null); |
||||
}); |
||||
|
||||
test('Set status', () async { |
||||
final response = await client.userStatus.userStatus.setStatus(statusType: 'online'); |
||||
|
||||
expect(response.ocs.data.public.userId, 'user1'); |
||||
expect(response.ocs.data.public.message, null); |
||||
expect(response.ocs.data.private1.messageId, null); |
||||
expect(response.ocs.data.private1.messageIsPredefined, false); |
||||
expect(response.ocs.data.public.icon, null); |
||||
expect(response.ocs.data.public.clearAt, null); |
||||
expect(response.ocs.data.public.status, 'online'); |
||||
expect(response.ocs.data.private1.statusIsUserDefined, true); |
||||
}); |
||||
|
||||
test('Get status', () async { |
||||
// There seems to be a bug in Nextcloud which makes getting the status fail before it has been set once. |
||||
// The error message from Nextcloud is "Could not create folder" |
||||
await client.userStatus.userStatus.setStatus(statusType: 'online'); |
||||
|
||||
final response = await client.userStatus.userStatus.getStatus(); |
||||
expect(response.ocs.data.public.userId, 'user1'); |
||||
expect(response.ocs.data.public.message, null); |
||||
expect(response.ocs.data.private1.messageId, null); |
||||
expect(response.ocs.data.private1.messageIsPredefined, false); |
||||
expect(response.ocs.data.public.icon, null); |
||||
expect(response.ocs.data.public.clearAt, null); |
||||
expect(response.ocs.data.public.status, 'online'); |
||||
expect(response.ocs.data.private1.statusIsUserDefined, true); |
||||
}); |
||||
|
||||
test('Find all statuses', () async { |
||||
var response = await client.userStatus.statuses.findAll(); |
||||
expect(response.ocs.data, hasLength(0)); |
||||
|
||||
await client.userStatus.userStatus.setStatus(statusType: 'online'); |
||||
|
||||
response = await client.userStatus.statuses.findAll(); |
||||
expect(response.ocs.data, hasLength(1)); |
||||
expect(response.ocs.data[0].userId, 'user1'); |
||||
expect(response.ocs.data[0].message, null); |
||||
expect(response.ocs.data[0].icon, null); |
||||
expect(response.ocs.data[0].clearAt, null); |
||||
expect(response.ocs.data[0].status, 'online'); |
||||
}); |
||||
|
||||
test('Find status', () async { |
||||
// Same as getting status |
||||
await client.userStatus.userStatus.setStatus(statusType: 'online'); |
||||
|
||||
final response = await client.userStatus.statuses.find(userId: 'user1'); |
||||
expect(response.ocs.data.userId, 'user1'); |
||||
expect(response.ocs.data.message, null); |
||||
expect(response.ocs.data.icon, null); |
||||
expect(response.ocs.data.clearAt, null); |
||||
expect(response.ocs.data.status, 'online'); |
||||
}); |
||||
|
||||
test('Set predefined message', () async { |
||||
final clearAt = DateTime.now().millisecondsSinceEpoch ~/ 1000 + 60; |
||||
final response = await client.userStatus.userStatus.setPredefinedMessage( |
||||
messageId: 'meeting', |
||||
clearAt: clearAt, |
||||
); |
||||
expect(response.ocs.data.public.userId, 'user1'); |
||||
expect(response.ocs.data.public.message, null); |
||||
expect(response.ocs.data.private1.messageId, 'meeting'); |
||||
expect(response.ocs.data.private1.messageIsPredefined, true); |
||||
expect(response.ocs.data.public.icon, null); |
||||
expect(response.ocs.data.public.clearAt, clearAt); |
||||
expect(response.ocs.data.public.status, 'offline'); |
||||
expect(response.ocs.data.private1.statusIsUserDefined, false); |
||||
}); |
||||
|
||||
test('Set custom message', () async { |
||||
final clearAt = DateTime.now().millisecondsSinceEpoch ~/ 1000 + 60; |
||||
final response = await client.userStatus.userStatus.setCustomMessage( |
||||
statusIcon: '😀', |
||||
message: 'bla', |
||||
clearAt: clearAt, |
||||
); |
||||
expect(response.ocs.data.public.userId, 'user1'); |
||||
expect(response.ocs.data.public.message, 'bla'); |
||||
expect(response.ocs.data.private1.messageId, null); |
||||
expect(response.ocs.data.private1.messageIsPredefined, false); |
||||
expect(response.ocs.data.public.icon, '😀'); |
||||
expect(response.ocs.data.public.clearAt, clearAt); |
||||
expect(response.ocs.data.public.status, 'offline'); |
||||
expect(response.ocs.data.private1.statusIsUserDefined, false); |
||||
}); |
||||
|
||||
test('Clear message', () async { |
||||
final clearAt = DateTime.now().millisecondsSinceEpoch ~/ 1000 + 60; |
||||
await client.userStatus.userStatus.setCustomMessage( |
||||
statusIcon: '😀', |
||||
message: 'bla', |
||||
clearAt: clearAt, |
||||
); |
||||
await client.userStatus.userStatus.clearMessage(); |
||||
|
||||
final response = await client.userStatus.userStatus.getStatus(); |
||||
expect(response.ocs.data.public.userId, 'user1'); |
||||
expect(response.ocs.data.public.message, null); |
||||
expect(response.ocs.data.private1.messageId, null); |
||||
expect(response.ocs.data.private1.messageIsPredefined, false); |
||||
expect(response.ocs.data.public.icon, null); |
||||
expect(response.ocs.data.public.clearAt, null); |
||||
expect(response.ocs.data.public.status, 'offline'); |
||||
expect(response.ocs.data.private1.statusIsUserDefined, false); |
||||
}); |
||||
|
||||
test('Heartbeat', () async { |
||||
final response = await client.userStatus.heartbeat.heartbeat(status: 'online'); |
||||
expect(response.ocs.data.public.userId, 'user1'); |
||||
expect(response.ocs.data.public.message, null); |
||||
expect(response.ocs.data.private1.messageId, null); |
||||
expect(response.ocs.data.private1.messageIsPredefined, false); |
||||
expect(response.ocs.data.public.icon, null); |
||||
expect(response.ocs.data.public.clearAt, null); |
||||
expect(response.ocs.data.public.status, 'online'); |
||||
expect(response.ocs.data.private1.statusIsUserDefined, false); |
||||
}); |
||||
}); |
||||
group( |
||||
'user_status', |
||||
() { |
||||
late DockerImage image; |
||||
setUpAll(() async => image = await getDockerImage()); |
||||
|
||||
late DockerContainer container; |
||||
late TestNextcloudClient client; |
||||
setUp(() async { |
||||
container = await getDockerContainer(image); |
||||
client = await getTestClient(container); |
||||
}); |
||||
tearDown(() => container.destroy()); |
||||
|
||||
test('Find all predefined statuses', () async { |
||||
final expectedStatusIDs = ['meeting', 'commuting', 'remote-work', 'sick-leave', 'vacationing']; |
||||
final response = await client.userStatus.predefinedStatus.findAll(); |
||||
expect(response.ocs.data, hasLength(5)); |
||||
final responseIDs = response.ocs.data.map((final status) => status.id); |
||||
expect(expectedStatusIDs.map(responseIDs.contains).contains(false), false); |
||||
for (final status in response.ocs.data) { |
||||
expect(status.icon, isNotNull); |
||||
expect(status.message, isNotNull); |
||||
} |
||||
|
||||
final meeting = response.ocs.data.singleWhere((final s) => s.id == 'meeting').clearAt!; |
||||
expect(meeting.type, UserStatusClearAt_Type.period); |
||||
expect(meeting.time.$int, 3600); |
||||
|
||||
final commuting = response.ocs.data.singleWhere((final s) => s.id == 'commuting').clearAt!; |
||||
expect(commuting.type, UserStatusClearAt_Type.period); |
||||
expect(commuting.time.$int, 1800); |
||||
|
||||
final remoteWork = response.ocs.data.singleWhere((final s) => s.id == 'remote-work').clearAt!; |
||||
expect(remoteWork.type, UserStatusClearAt_Type.endOf); |
||||
expect(remoteWork.time.clearAtTimeType, UserStatusClearAtTimeType.day); |
||||
|
||||
final sickLeave = response.ocs.data.singleWhere((final s) => s.id == 'sick-leave').clearAt!; |
||||
expect(sickLeave.type, UserStatusClearAt_Type.endOf); |
||||
expect(sickLeave.time.clearAtTimeType, UserStatusClearAtTimeType.day); |
||||
|
||||
final vacationing = response.ocs.data.singleWhere((final s) => s.id == 'vacationing').clearAt; |
||||
expect(vacationing, null); |
||||
}); |
||||
|
||||
test('Set status', () async { |
||||
final response = await client.userStatus.userStatus.setStatus(statusType: 'online'); |
||||
|
||||
expect(response.ocs.data.public.userId, 'user1'); |
||||
expect(response.ocs.data.public.message, null); |
||||
expect(response.ocs.data.private1.messageId, null); |
||||
expect(response.ocs.data.private1.messageIsPredefined, false); |
||||
expect(response.ocs.data.public.icon, null); |
||||
expect(response.ocs.data.public.clearAt, null); |
||||
expect(response.ocs.data.public.status, 'online'); |
||||
expect(response.ocs.data.private1.statusIsUserDefined, true); |
||||
}); |
||||
|
||||
test('Get status', () async { |
||||
// There seems to be a bug in Nextcloud which makes getting the status fail before it has been set once. |
||||
// The error message from Nextcloud is "Could not create folder" |
||||
await client.userStatus.userStatus.setStatus(statusType: 'online'); |
||||
|
||||
final response = await client.userStatus.userStatus.getStatus(); |
||||
expect(response.ocs.data.public.userId, 'user1'); |
||||
expect(response.ocs.data.public.message, null); |
||||
expect(response.ocs.data.private1.messageId, null); |
||||
expect(response.ocs.data.private1.messageIsPredefined, false); |
||||
expect(response.ocs.data.public.icon, null); |
||||
expect(response.ocs.data.public.clearAt, null); |
||||
expect(response.ocs.data.public.status, 'online'); |
||||
expect(response.ocs.data.private1.statusIsUserDefined, true); |
||||
}); |
||||
|
||||
test('Find all statuses', () async { |
||||
var response = await client.userStatus.statuses.findAll(); |
||||
expect(response.ocs.data, hasLength(0)); |
||||
|
||||
await client.userStatus.userStatus.setStatus(statusType: 'online'); |
||||
|
||||
response = await client.userStatus.statuses.findAll(); |
||||
expect(response.ocs.data, hasLength(1)); |
||||
expect(response.ocs.data[0].userId, 'user1'); |
||||
expect(response.ocs.data[0].message, null); |
||||
expect(response.ocs.data[0].icon, null); |
||||
expect(response.ocs.data[0].clearAt, null); |
||||
expect(response.ocs.data[0].status, 'online'); |
||||
}); |
||||
|
||||
test('Find status', () async { |
||||
// Same as getting status |
||||
await client.userStatus.userStatus.setStatus(statusType: 'online'); |
||||
|
||||
final response = await client.userStatus.statuses.find(userId: 'user1'); |
||||
expect(response.ocs.data.userId, 'user1'); |
||||
expect(response.ocs.data.message, null); |
||||
expect(response.ocs.data.icon, null); |
||||
expect(response.ocs.data.clearAt, null); |
||||
expect(response.ocs.data.status, 'online'); |
||||
}); |
||||
|
||||
test('Set predefined message', () async { |
||||
final clearAt = DateTime.now().millisecondsSinceEpoch ~/ 1000 + 60; |
||||
final response = await client.userStatus.userStatus.setPredefinedMessage( |
||||
messageId: 'meeting', |
||||
clearAt: clearAt, |
||||
); |
||||
expect(response.ocs.data.public.userId, 'user1'); |
||||
expect(response.ocs.data.public.message, null); |
||||
expect(response.ocs.data.private1.messageId, 'meeting'); |
||||
expect(response.ocs.data.private1.messageIsPredefined, true); |
||||
expect(response.ocs.data.public.icon, null); |
||||
expect(response.ocs.data.public.clearAt, clearAt); |
||||
expect(response.ocs.data.public.status, 'offline'); |
||||
expect(response.ocs.data.private1.statusIsUserDefined, false); |
||||
}); |
||||
|
||||
test('Set custom message', () async { |
||||
final clearAt = DateTime.now().millisecondsSinceEpoch ~/ 1000 + 60; |
||||
final response = await client.userStatus.userStatus.setCustomMessage( |
||||
statusIcon: '😀', |
||||
message: 'bla', |
||||
clearAt: clearAt, |
||||
); |
||||
expect(response.ocs.data.public.userId, 'user1'); |
||||
expect(response.ocs.data.public.message, 'bla'); |
||||
expect(response.ocs.data.private1.messageId, null); |
||||
expect(response.ocs.data.private1.messageIsPredefined, false); |
||||
expect(response.ocs.data.public.icon, '😀'); |
||||
expect(response.ocs.data.public.clearAt, clearAt); |
||||
expect(response.ocs.data.public.status, 'offline'); |
||||
expect(response.ocs.data.private1.statusIsUserDefined, false); |
||||
}); |
||||
|
||||
test('Clear message', () async { |
||||
final clearAt = DateTime.now().millisecondsSinceEpoch ~/ 1000 + 60; |
||||
await client.userStatus.userStatus.setCustomMessage( |
||||
statusIcon: '😀', |
||||
message: 'bla', |
||||
clearAt: clearAt, |
||||
); |
||||
await client.userStatus.userStatus.clearMessage(); |
||||
|
||||
final response = await client.userStatus.userStatus.getStatus(); |
||||
expect(response.ocs.data.public.userId, 'user1'); |
||||
expect(response.ocs.data.public.message, null); |
||||
expect(response.ocs.data.private1.messageId, null); |
||||
expect(response.ocs.data.private1.messageIsPredefined, false); |
||||
expect(response.ocs.data.public.icon, null); |
||||
expect(response.ocs.data.public.clearAt, null); |
||||
expect(response.ocs.data.public.status, 'offline'); |
||||
expect(response.ocs.data.private1.statusIsUserDefined, false); |
||||
}); |
||||
|
||||
test('Heartbeat', () async { |
||||
final response = await client.userStatus.heartbeat.heartbeat(status: 'online'); |
||||
expect(response.ocs.data.public.userId, 'user1'); |
||||
expect(response.ocs.data.public.message, null); |
||||
expect(response.ocs.data.private1.messageId, null); |
||||
expect(response.ocs.data.private1.messageIsPredefined, false); |
||||
expect(response.ocs.data.public.icon, null); |
||||
expect(response.ocs.data.public.clearAt, null); |
||||
expect(response.ocs.data.public.status, 'online'); |
||||
expect(response.ocs.data.private1.statusIsUserDefined, false); |
||||
}); |
||||
}, |
||||
retry: retryCount, |
||||
timeout: timeout, |
||||
); |
||||
} |
||||
|
Loading…
Reference in new issue