You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
104 lines
4.1 KiB
104 lines
4.1 KiB
2 years ago
|
import 'package:nextcloud/nextcloud.dart';
|
||
2 years ago
|
import 'package:test/test.dart';
|
||
|
|
||
|
import 'helper.dart';
|
||
|
|
||
|
Future main() async {
|
||
2 years ago
|
await run(await getDockerImage());
|
||
|
}
|
||
2 years ago
|
|
||
2 years ago
|
Future run(final DockerImage image) async {
|
||
2 years ago
|
group('core', () {
|
||
2 years ago
|
late DockerContainer container;
|
||
2 years ago
|
late TestNextcloudClient client;
|
||
2 years ago
|
setUp(() async {
|
||
|
container = await getDockerContainer(image);
|
||
|
client = await getTestClient(container);
|
||
|
});
|
||
|
tearDown(() => container.destroy());
|
||
2 years ago
|
|
||
2 years ago
|
test('Is supported', () async {
|
||
|
final response = await client.core.isSupported();
|
||
|
expect(response, isTrue);
|
||
|
});
|
||
|
|
||
2 years ago
|
test('Get status', () async {
|
||
2 years ago
|
final status = await client.core.getStatus();
|
||
2 years ago
|
print(status.toJson());
|
||
2 years ago
|
expect(status.installed, true);
|
||
|
expect(status.maintenance, false);
|
||
|
expect(status.needsDbUpgrade, false);
|
||
2 years ago
|
expect(status.version, startsWith('25.0.2'));
|
||
|
expect(status.versionstring, '25.0.2');
|
||
2 years ago
|
expect(status.edition, '');
|
||
|
expect(status.productname, 'Nextcloud');
|
||
|
expect(status.extendedSupport, false);
|
||
|
});
|
||
|
|
||
|
test('Get capabilities', () async {
|
||
2 years ago
|
final capabilities = await client.core.getCapabilities();
|
||
2 years ago
|
expect(capabilities.ocs.data.version.major.toString(), '25');
|
||
|
expect(capabilities.ocs.data.version.string, '25.0.2');
|
||
2 years ago
|
expect(capabilities.ocs.data.capabilities.theming!.name, 'Nextcloud');
|
||
|
expect(capabilities.ocs.data.capabilities.theming!.url, 'https://nextcloud.com');
|
||
|
expect(capabilities.ocs.data.capabilities.theming!.slogan, 'a safe home for all your data');
|
||
|
expect(capabilities.ocs.data.capabilities.theming!.color, '#0082c9');
|
||
|
expect(capabilities.ocs.data.capabilities.theming!.colorText, '#ffffff');
|
||
|
expect(capabilities.ocs.data.capabilities.theming!.logo, isNotEmpty);
|
||
|
expect(capabilities.ocs.data.capabilities.theming!.background, isNotEmpty);
|
||
|
expect(capabilities.ocs.data.capabilities.theming!.backgroundPlain, false);
|
||
|
expect(capabilities.ocs.data.capabilities.theming!.backgroundDefault, true);
|
||
|
expect(capabilities.ocs.data.capabilities.theming!.logoheader, isNotEmpty);
|
||
|
expect(capabilities.ocs.data.capabilities.theming!.favicon, isNotEmpty);
|
||
2 years ago
|
});
|
||
|
|
||
|
test('Get navigation apps', () async {
|
||
2 years ago
|
final navigationApps = await client.core.getNavigationApps();
|
||
2 years ago
|
expect(navigationApps.ocs.data, hasLength(6));
|
||
2 years ago
|
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');
|
||
2 years ago
|
expect(navigationApps.ocs.data[4].id, 'notes');
|
||
|
expect(navigationApps.ocs.data[5].id, 'news');
|
||
2 years ago
|
});
|
||
|
|
||
|
test('Autocomplete', () async {
|
||
|
final response = await client.core.autocomplete(
|
||
|
search: '',
|
||
|
itemType: 'call',
|
||
|
itemId: 'new',
|
||
|
shareTypes: [
|
||
|
ShareType.user.code,
|
||
|
ShareType.group.code,
|
||
|
],
|
||
|
);
|
||
2 years ago
|
expect(response.ocs.data, hasLength(3));
|
||
2 years ago
|
|
||
|
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.string, isNull);
|
||
|
expect(response.ocs.data[0].subline, '');
|
||
|
expect(response.ocs.data[0].shareWithDisplayNameUnique, 'admin@example.com');
|
||
|
|
||
2 years ago
|
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.string, isNull);
|
||
2 years ago
|
expect(response.ocs.data[1].subline, '');
|
||
2 years ago
|
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.string, isEmpty);
|
||
|
expect(response.ocs.data[2].subline, '');
|
||
|
expect(response.ocs.data[2].shareWithDisplayNameUnique, '');
|
||
2 years ago
|
});
|
||
|
});
|
||
|
}
|