|
|
@ -4,159 +4,164 @@ import 'package:test/test.dart'; |
|
|
|
import 'helper.dart'; |
|
|
|
import 'helper.dart'; |
|
|
|
|
|
|
|
|
|
|
|
void main() { |
|
|
|
void main() { |
|
|
|
group( |
|
|
|
for (final serverVersion in coreSupportedVersions) { |
|
|
|
'core', |
|
|
|
final serverVersionMajor = int.parse(serverVersion.split('.').first); |
|
|
|
() { |
|
|
|
group( |
|
|
|
late DockerImage image; |
|
|
|
serverVersion, |
|
|
|
setUpAll(() async => image = await getDockerImage()); |
|
|
|
() { |
|
|
|
|
|
|
|
group('core', () { |
|
|
|
late DockerContainer container; |
|
|
|
late DockerImage image; |
|
|
|
late TestNextcloudClient client; |
|
|
|
setUpAll(() async => image = await getDockerImage(serverVersion: serverVersion)); |
|
|
|
setUp(() async { |
|
|
|
|
|
|
|
container = await getDockerContainer(image); |
|
|
|
late DockerContainer container; |
|
|
|
client = await getTestClient(container); |
|
|
|
late TestNextcloudClient client; |
|
|
|
}); |
|
|
|
setUp(() async { |
|
|
|
tearDown(() => container.destroy()); |
|
|
|
container = await getDockerContainer(image); |
|
|
|
|
|
|
|
client = await getTestClient(container); |
|
|
|
test('Is supported from capabilities', () async { |
|
|
|
}); |
|
|
|
final (supported, _) = client.core.isSupported((await client.core.ocs.getCapabilities()).ocs.data); |
|
|
|
tearDown(() => container.destroy()); |
|
|
|
expect(supported, isTrue); |
|
|
|
|
|
|
|
}); |
|
|
|
test('Is supported from capabilities', () async { |
|
|
|
|
|
|
|
final (supported, _) = client.core.isSupported((await client.core.ocs.getCapabilities()).ocs.data); |
|
|
|
test('Is supported from status', () async { |
|
|
|
expect(supported, isTrue); |
|
|
|
final status = await client.core.getStatus(); |
|
|
|
}); |
|
|
|
expect(status.isSupported, isTrue); |
|
|
|
|
|
|
|
}); |
|
|
|
test('Is supported from status', () async { |
|
|
|
|
|
|
|
final status = await client.core.getStatus(); |
|
|
|
test('Get status', () async { |
|
|
|
expect(status.isSupported, isTrue); |
|
|
|
final status = await client.core.getStatus(); |
|
|
|
}); |
|
|
|
expect(status.installed, true); |
|
|
|
|
|
|
|
expect(status.maintenance, false); |
|
|
|
test('Get status', () async { |
|
|
|
expect(status.needsDbUpgrade, false); |
|
|
|
final status = await client.core.getStatus(); |
|
|
|
expect(status.version, startsWith('$coreSupportedVersion.')); |
|
|
|
expect(status.installed, true); |
|
|
|
expect(status.versionstring, startsWith('$coreSupportedVersion.')); |
|
|
|
expect(status.maintenance, false); |
|
|
|
expect(status.edition, ''); |
|
|
|
expect(status.needsDbUpgrade, false); |
|
|
|
expect(status.productname, 'Nextcloud'); |
|
|
|
expect(status.version, startsWith('$serverVersion.')); |
|
|
|
expect(status.extendedSupport, false); |
|
|
|
expect(status.versionstring, serverVersion); |
|
|
|
}); |
|
|
|
expect(status.edition, ''); |
|
|
|
|
|
|
|
expect(status.productname, 'Nextcloud'); |
|
|
|
test('Get capabilities', () async { |
|
|
|
expect(status.extendedSupport, false); |
|
|
|
final capabilities = await client.core.ocs.getCapabilities(); |
|
|
|
}); |
|
|
|
expect(capabilities.ocs.data.version.major, coreSupportedVersion); |
|
|
|
|
|
|
|
expect(capabilities.ocs.data.version.string, startsWith('$coreSupportedVersion.')); |
|
|
|
test('Get capabilities', () async { |
|
|
|
expect(capabilities.ocs.data.capabilities.commentsCapabilities, isNotNull); |
|
|
|
final capabilities = await client.core.ocs.getCapabilities(); |
|
|
|
expect(capabilities.ocs.data.capabilities.davCapabilities, isNotNull); |
|
|
|
expect(capabilities.ocs.data.version.major, serverVersionMajor); |
|
|
|
expect(capabilities.ocs.data.capabilities.filesCapabilities, isNotNull); |
|
|
|
expect(capabilities.ocs.data.version.string, serverVersion); |
|
|
|
expect(capabilities.ocs.data.capabilities.filesSharingCapabilities, isNotNull); |
|
|
|
expect(capabilities.ocs.data.capabilities.commentsCapabilities, isNotNull); |
|
|
|
expect(capabilities.ocs.data.capabilities.filesTrashbinCapabilities, isNotNull); |
|
|
|
expect(capabilities.ocs.data.capabilities.davCapabilities, isNotNull); |
|
|
|
expect(capabilities.ocs.data.capabilities.filesVersionsCapabilities, isNotNull); |
|
|
|
expect(capabilities.ocs.data.capabilities.filesCapabilities, isNotNull); |
|
|
|
expect(capabilities.ocs.data.capabilities.notesCapabilities, isNotNull); |
|
|
|
expect(capabilities.ocs.data.capabilities.filesSharingCapabilities, isNotNull); |
|
|
|
expect(capabilities.ocs.data.capabilities.notificationsCapabilities, isNotNull); |
|
|
|
expect(capabilities.ocs.data.capabilities.filesTrashbinCapabilities, isNotNull); |
|
|
|
expect(capabilities.ocs.data.capabilities.provisioningApiCapabilities, isNotNull); |
|
|
|
expect(capabilities.ocs.data.capabilities.filesVersionsCapabilities, isNotNull); |
|
|
|
expect(capabilities.ocs.data.capabilities.sharebymailCapabilities, isNotNull); |
|
|
|
expect(capabilities.ocs.data.capabilities.notesCapabilities, isNotNull); |
|
|
|
expect(capabilities.ocs.data.capabilities.themingPublicCapabilities, isNotNull); |
|
|
|
expect(capabilities.ocs.data.capabilities.notificationsCapabilities, isNotNull); |
|
|
|
expect(capabilities.ocs.data.capabilities.userStatusCapabilities, isNotNull); |
|
|
|
expect(capabilities.ocs.data.capabilities.provisioningApiCapabilities, isNotNull); |
|
|
|
expect(capabilities.ocs.data.capabilities.weatherStatusCapabilities, isNotNull); |
|
|
|
expect(capabilities.ocs.data.capabilities.sharebymailCapabilities, isNotNull); |
|
|
|
}); |
|
|
|
expect(capabilities.ocs.data.capabilities.themingPublicCapabilities, isNotNull); |
|
|
|
|
|
|
|
expect(capabilities.ocs.data.capabilities.userStatusCapabilities, isNotNull); |
|
|
|
test('Get navigation apps', () async { |
|
|
|
expect(capabilities.ocs.data.capabilities.weatherStatusCapabilities, isNotNull); |
|
|
|
final navigationApps = await client.core.navigation.getAppsNavigation(); |
|
|
|
}); |
|
|
|
expect(navigationApps.ocs.data, hasLength(6)); |
|
|
|
|
|
|
|
expect(navigationApps.ocs.data[0].id, 'dashboard'); |
|
|
|
test('Get navigation apps', () async { |
|
|
|
expect(navigationApps.ocs.data[1].id, 'files'); |
|
|
|
final navigationApps = await client.core.navigation.getAppsNavigation(); |
|
|
|
expect(navigationApps.ocs.data[2].id, 'photos'); |
|
|
|
expect(navigationApps.ocs.data, hasLength(6)); |
|
|
|
expect(navigationApps.ocs.data[3].id, 'activity'); |
|
|
|
expect(navigationApps.ocs.data[0].id, 'dashboard'); |
|
|
|
expect(navigationApps.ocs.data[4].id, 'notes'); |
|
|
|
expect(navigationApps.ocs.data[1].id, 'files'); |
|
|
|
expect(navigationApps.ocs.data[5].id, 'news'); |
|
|
|
expect(navigationApps.ocs.data[2].id, 'photos'); |
|
|
|
}); |
|
|
|
expect(navigationApps.ocs.data[3].id, 'activity'); |
|
|
|
|
|
|
|
expect(navigationApps.ocs.data[4].id, 'notes'); |
|
|
|
test( |
|
|
|
expect(navigationApps.ocs.data[5].id, 'news'); |
|
|
|
'Autocomplete', |
|
|
|
}); |
|
|
|
() async { |
|
|
|
|
|
|
|
final response = await client.core.autoComplete.$get( |
|
|
|
test( |
|
|
|
search: '', |
|
|
|
'Autocomplete', |
|
|
|
itemType: 'call', |
|
|
|
() async { |
|
|
|
itemId: 'new', |
|
|
|
final response = await client.core.autoComplete.$get( |
|
|
|
shareTypes: [ |
|
|
|
search: '', |
|
|
|
ShareType.user.index, |
|
|
|
itemType: 'call', |
|
|
|
ShareType.group.index, |
|
|
|
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: serverVersionMajor < 28, // This test only works on 28+ due to a bug fix with the status |
|
|
|
); |
|
|
|
); |
|
|
|
expect(response.ocs.data, hasLength(3)); |
|
|
|
|
|
|
|
|
|
|
|
test('Get preview', () async { |
|
|
|
expect(response.ocs.data[0].id, 'admin'); |
|
|
|
final response = await client.core.preview.getPreview(file: 'Nextcloud.png'); |
|
|
|
expect(response.ocs.data[0].label, 'admin'); |
|
|
|
expect(response, isNotEmpty); |
|
|
|
expect(response.ocs.data[0].icon, 'icon-user'); |
|
|
|
}); |
|
|
|
expect(response.ocs.data[0].source, 'users'); |
|
|
|
|
|
|
|
expect(response.ocs.data[0].status, isEmpty); |
|
|
|
test('Get avatar', () async { |
|
|
|
expect(response.ocs.data[0].subline, ''); |
|
|
|
final response = await client.core.avatar.getAvatar(userId: 'admin', size: 32); |
|
|
|
expect(response.ocs.data[0].shareWithDisplayNameUnique, 'admin@example.com'); |
|
|
|
expect(response.data, isNotEmpty); |
|
|
|
|
|
|
|
}); |
|
|
|
expect(response.ocs.data[1].id, 'user2'); |
|
|
|
|
|
|
|
expect(response.ocs.data[1].label, 'User Two'); |
|
|
|
test('Get dark avatar', () async { |
|
|
|
expect(response.ocs.data[1].icon, 'icon-user'); |
|
|
|
final response = await client.core.avatar.getAvatarDark(userId: 'admin', size: 32); |
|
|
|
expect(response.ocs.data[1].source, 'users'); |
|
|
|
expect(response.data, isNotEmpty); |
|
|
|
expect(response.ocs.data[1].status, isEmpty); |
|
|
|
}); |
|
|
|
expect(response.ocs.data[1].subline, ''); |
|
|
|
|
|
|
|
expect(response.ocs.data[1].shareWithDisplayNameUnique, 'user2'); |
|
|
|
test('Delete app password', () async { |
|
|
|
|
|
|
|
await client.core.appPassword.deleteAppPassword(); |
|
|
|
expect(response.ocs.data[2].id, 'admin'); |
|
|
|
expect( |
|
|
|
expect(response.ocs.data[2].label, 'admin'); |
|
|
|
() => client.core.appPassword.deleteAppPassword(), |
|
|
|
expect(response.ocs.data[2].icon, ''); |
|
|
|
throwsA(predicate((final e) => (e! as DynamiteApiException).statusCode == 401)), |
|
|
|
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, ''); |
|
|
|
test('Unified search providers', () async { |
|
|
|
}, |
|
|
|
final response = await client.core.unifiedSearch.getProviders(); |
|
|
|
skip: true, // TODO: This test only works on 28+ due to a bug fix with the status |
|
|
|
expect(response.ocs.data, hasLength(13)); |
|
|
|
); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
test('Get preview', () async { |
|
|
|
test('Unified search', () async { |
|
|
|
final response = await client.core.preview.getPreview(file: 'Nextcloud.png'); |
|
|
|
final response = await client.core.unifiedSearch.search( |
|
|
|
expect(response, isNotEmpty); |
|
|
|
providerId: 'settings', |
|
|
|
}); |
|
|
|
term: 'Personal info', |
|
|
|
|
|
|
|
); |
|
|
|
test('Get avatar', () async { |
|
|
|
expect(response.ocs.data.name, 'Settings'); |
|
|
|
final response = await client.core.avatar.getAvatar(userId: 'admin', size: 32); |
|
|
|
expect(response.ocs.data.isPaginated, isFalse); |
|
|
|
expect(response.data, isNotEmpty); |
|
|
|
expect(response.ocs.data.entries, hasLength(1)); |
|
|
|
}); |
|
|
|
expect(response.ocs.data.entries.single.thumbnailUrl, isEmpty); |
|
|
|
|
|
|
|
expect(response.ocs.data.entries.single.title, 'Personal info'); |
|
|
|
test('Get dark avatar', () async { |
|
|
|
expect(response.ocs.data.entries.single.subline, isEmpty); |
|
|
|
final response = await client.core.avatar.getAvatarDark(userId: 'admin', size: 32); |
|
|
|
expect(response.ocs.data.entries.single.resourceUrl, isNotEmpty); |
|
|
|
expect(response.data, 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('Delete app password', () async { |
|
|
|
}); |
|
|
|
await client.core.appPassword.deleteAppPassword(); |
|
|
|
}); |
|
|
|
expect( |
|
|
|
}, |
|
|
|
() => client.core.appPassword.deleteAppPassword(), |
|
|
|
retry: retryCount, |
|
|
|
throwsA(predicate((final e) => (e! as DynamiteApiException).statusCode == 401)), |
|
|
|
timeout: timeout, |
|
|
|
); |
|
|
|
); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
retry: retryCount, |
|
|
|
|
|
|
|
timeout: timeout, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|