|
|
|
@ -18,7 +18,8 @@ void main() {
|
|
|
|
|
}); |
|
|
|
|
tearDown(() => container.destroy()); |
|
|
|
|
|
|
|
|
|
test('Find all predefined statuses', () async { |
|
|
|
|
group('Predefined status', () { |
|
|
|
|
test('Find all', () async { |
|
|
|
|
final expectedStatusIDs = ['meeting', 'commuting', 'remote-work', 'sick-leave', 'vacationing']; |
|
|
|
|
final response = await client.userStatus.predefinedStatus.findAll(); |
|
|
|
|
expect(response.statusCode, 200); |
|
|
|
@ -51,8 +52,10 @@ void main() {
|
|
|
|
|
final vacationing = response.body.ocs.data.singleWhere((final s) => s.id == 'vacationing').clearAt; |
|
|
|
|
expect(vacationing, null); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('Set status', () async { |
|
|
|
|
group('User status', () { |
|
|
|
|
test('Set', () async { |
|
|
|
|
final response = await client.userStatus.userStatus.setStatus(statusType: 'online'); |
|
|
|
|
expect(response.statusCode, 200); |
|
|
|
|
expect(() => response.headers, isA<void>()); |
|
|
|
@ -67,7 +70,7 @@ void main() {
|
|
|
|
|
expect(response.body.ocs.data.statusIsUserDefined, true); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('Get status', () async { |
|
|
|
|
test('Get', () 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'); |
|
|
|
@ -86,26 +89,7 @@ void main() {
|
|
|
|
|
expect(response.body.ocs.data.statusIsUserDefined, true); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('Find all statuses', () async { |
|
|
|
|
var response = await client.userStatus.statuses.findAll(); |
|
|
|
|
expect(response.statusCode, 200); |
|
|
|
|
expect(() => response.headers, isA<void>()); |
|
|
|
|
expect(response.body.ocs.data, hasLength(0)); |
|
|
|
|
|
|
|
|
|
await client.userStatus.userStatus.setStatus(statusType: 'online'); |
|
|
|
|
|
|
|
|
|
response = await client.userStatus.statuses.findAll(); |
|
|
|
|
expect(response.statusCode, 200); |
|
|
|
|
expect(() => response.headers, isA<void>()); |
|
|
|
|
expect(response.body.ocs.data, hasLength(1)); |
|
|
|
|
expect(response.body.ocs.data[0].userId, 'user1'); |
|
|
|
|
expect(response.body.ocs.data[0].message, null); |
|
|
|
|
expect(response.body.ocs.data[0].icon, null); |
|
|
|
|
expect(response.body.ocs.data[0].clearAt, null); |
|
|
|
|
expect(response.body.ocs.data[0].status, 'online'); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('Find status', () async { |
|
|
|
|
test('Find', () async { |
|
|
|
|
// Same as getting status |
|
|
|
|
await client.userStatus.userStatus.setStatus(statusType: 'online'); |
|
|
|
|
|
|
|
|
@ -181,7 +165,30 @@ void main() {
|
|
|
|
|
expect(response.body.ocs.data.status, 'offline'); |
|
|
|
|
expect(response.body.ocs.data.statusIsUserDefined, false); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
group('Statuses', () { |
|
|
|
|
test('Find all', () async { |
|
|
|
|
var response = await client.userStatus.statuses.findAll(); |
|
|
|
|
expect(response.statusCode, 200); |
|
|
|
|
expect(() => response.headers, isA<void>()); |
|
|
|
|
expect(response.body.ocs.data, hasLength(0)); |
|
|
|
|
|
|
|
|
|
await client.userStatus.userStatus.setStatus(statusType: 'online'); |
|
|
|
|
|
|
|
|
|
response = await client.userStatus.statuses.findAll(); |
|
|
|
|
expect(response.statusCode, 200); |
|
|
|
|
expect(() => response.headers, isA<void>()); |
|
|
|
|
expect(response.body.ocs.data, hasLength(1)); |
|
|
|
|
expect(response.body.ocs.data[0].userId, 'user1'); |
|
|
|
|
expect(response.body.ocs.data[0].message, null); |
|
|
|
|
expect(response.body.ocs.data[0].icon, null); |
|
|
|
|
expect(response.body.ocs.data[0].clearAt, null); |
|
|
|
|
expect(response.body.ocs.data[0].status, 'online'); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
group('Heartbeat', () { |
|
|
|
|
test('Heartbeat', () async { |
|
|
|
|
final response = await client.userStatus.heartbeat.heartbeat(status: 'online'); |
|
|
|
|
expect(response.statusCode, 200); |
|
|
|
@ -196,6 +203,7 @@ void main() {
|
|
|
|
|
expect(response.body.ocs.data.status, 'online'); |
|
|
|
|
expect(response.body.ocs.data.statusIsUserDefined, false); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
retry: retryCount, |
|
|
|
|
timeout: timeout, |
|
|
|
|