Skip to content

Commit

Permalink
refactor(nextcloud): Reuse containers in tests
Browse files Browse the repository at this point in the history
Signed-off-by: jld3103 <[email protected]>
  • Loading branch information
provokateurin committed Dec 20, 2023
1 parent 0a8d488 commit f2f236b
Show file tree
Hide file tree
Showing 52 changed files with 530 additions and 317 deletions.
7 changes: 5 additions & 2 deletions packages/nextcloud/test/core_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ void main() {
(final preset) {
late DockerContainer container;
late NextcloudClient client;
setUp(() async {
setUpAll(() async {
container = await DockerContainer.create(preset);
client = await TestNextcloudClient.create(container);
});
tearDown(() async {
tearDownAll(() async {
if (Invoker.current!.liveTest.errors.isNotEmpty) {
print(await container.allLogs());
}
Expand Down Expand Up @@ -145,6 +145,9 @@ void main() {

group('App password', () {
test('Delete', () async {
// Separate client to not break other tests
final client = await TestNextcloudClient.create(container);

await client.core.appPassword.deleteAppPassword();
await expectLater(
() => client.core.appPassword.deleteAppPassword(),
Expand Down
4 changes: 2 additions & 2 deletions packages/nextcloud/test/dashboard_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ void main() {
(final preset) {
late DockerContainer container;
late NextcloudClient client;
setUp(() async {
setUpAll(() async {
container = await DockerContainer.create(preset);
client = await TestNextcloudClient.create(container);
});
tearDown(() async {
tearDownAll(() async {
if (Invoker.current!.liveTest.errors.isNotEmpty) {
print(await container.allLogs());
}
Expand Down
12 changes: 12 additions & 0 deletions packages/nextcloud/test/fixtures/notes/create_note_favorite.regexp
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
GET http://localhost/index\.php/apps/notes/api/v1/notes\?exclude=&pruneBefore=0&chunkSize=0
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
accept-encoding: gzip
content-length: 0
authorization: Basic mock(
DELETE http://localhost/index\.php/apps/notes/api/v1/notes/[0-9]+
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
accept-encoding: gzip
authorization: Basic mock)*
POST http://localhost/index\.php/apps/notes/api/v1/notes\?category=c&title=a&content=b&modified=0&favorite=1
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
GET http://localhost/index\.php/apps/notes/api/v1/notes\?exclude=&pruneBefore=0&chunkSize=0
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
accept-encoding: gzip
content-length: 0
authorization: Basic mock(
DELETE http://localhost/index\.php/apps/notes/api/v1/notes/[0-9]+
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
accept-encoding: gzip
authorization: Basic mock)*
POST http://localhost/index\.php/apps/notes/api/v1/notes\?category=c&title=a&content=b&modified=0&favorite=0
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
Expand Down
12 changes: 12 additions & 0 deletions packages/nextcloud/test/fixtures/notes/delete_note.regexp
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
GET http://localhost/index\.php/apps/notes/api/v1/notes\?exclude=&pruneBefore=0&chunkSize=0
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
accept-encoding: gzip
content-length: 0
authorization: Basic mock(
DELETE http://localhost/index\.php/apps/notes/api/v1/notes/[0-9]+
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
accept-encoding: gzip
authorization: Basic mock)*
POST http://localhost/index\.php/apps/notes/api/v1/notes\?category=&title=a&content=&modified=0&favorite=0
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
GET http://localhost/index\.php/apps/notes/api/v1/settings
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
accept-encoding: gzip
content-length: 0
authorization: Basic mock
PUT http://localhost/index\.php/apps/notes/api/v1/settings
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
Expand Down
12 changes: 12 additions & 0 deletions packages/nextcloud/test/fixtures/notes/get_note.regexp
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
GET http://localhost/index\.php/apps/notes/api/v1/notes\?exclude=&pruneBefore=0&chunkSize=0
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
accept-encoding: gzip
content-length: 0
authorization: Basic mock(
DELETE http://localhost/index\.php/apps/notes/api/v1/notes/[0-9]+
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
accept-encoding: gzip
authorization: Basic mock)*
POST http://localhost/index\.php/apps/notes/api/v1/notes\?category=&title=a&content=&modified=0&favorite=0
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
Expand Down
12 changes: 12 additions & 0 deletions packages/nextcloud/test/fixtures/notes/get_notes.regexp
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
GET http://localhost/index\.php/apps/notes/api/v1/notes\?exclude=&pruneBefore=0&chunkSize=0
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
accept-encoding: gzip
content-length: 0
authorization: Basic mock(
DELETE http://localhost/index\.php/apps/notes/api/v1/notes/[0-9]+
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
accept-encoding: gzip
authorization: Basic mock)*
POST http://localhost/index\.php/apps/notes/api/v1/notes\?category=&title=a&content=&modified=0&favorite=0
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
Expand Down
6 changes: 0 additions & 6 deletions packages/nextcloud/test/fixtures/notes/get_settings.regexp

This file was deleted.

12 changes: 12 additions & 0 deletions packages/nextcloud/test/fixtures/notes/update_note.regexp
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
GET http://localhost/index\.php/apps/notes/api/v1/notes\?exclude=&pruneBefore=0&chunkSize=0
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
accept-encoding: gzip
content-length: 0
authorization: Basic mock(
DELETE http://localhost/index\.php/apps/notes/api/v1/notes/[0-9]+
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
accept-encoding: gzip
authorization: Basic mock)*
POST http://localhost/index\.php/apps/notes/api/v1/notes\?category=&title=a&content=&modified=0&favorite=0
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
GET http://localhost/index\.php/apps/notes/api/v1/notes\?exclude=&pruneBefore=0&chunkSize=0
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
accept-encoding: gzip
content-length: 0
authorization: Basic mock(
DELETE http://localhost/index\.php/apps/notes/api/v1/notes/[0-9]+
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
accept-encoding: gzip
authorization: Basic mock)*
POST http://localhost/index\.php/apps/notes/api/v1/notes\?category=&title=a&content=&modified=0&favorite=0
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
DELETE http://localhost/ocs/v2\.php/apps/notifications/api/v2/notifications
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
accept-encoding: gzip
authorization: Bearer mock
ocs-apirequest: true
POST http://localhost/ocs/v2\.php/apps/notifications/api/v2/admin_notifications/admin\?shortMessage=123&longMessage=456
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
DELETE http://localhost/ocs/v2\.php/apps/notifications/api/v2/notifications
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
accept-encoding: gzip
authorization: Bearer mock
ocs-apirequest: true
POST http://localhost/ocs/v2\.php/apps/notifications/api/v2/admin_notifications/admin\?shortMessage=123&longMessage=456
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
accept-encoding: gzip
authorization: Bearer mock
ocs-apirequest: true
DELETE http://localhost/ocs/v2\.php/apps/notifications/api/v2/notifications/2
GET http://localhost/ocs/v2\.php/apps/notifications/api/v2/notifications
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
accept-encoding: gzip
content-length: 0
authorization: Bearer mock
ocs-apirequest: true
DELETE http://localhost/ocs/v2\.php/apps/notifications/api/v2/notifications/[0-9]+
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
DELETE http://localhost/ocs/v2\.php/apps/notifications/api/v2/notifications
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
accept-encoding: gzip
authorization: Bearer mock
ocs-apirequest: true
POST http://localhost/ocs/v2\.php/apps/notifications/api/v2/admin_notifications/admin\?shortMessage=123&longMessage=456
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
accept-encoding: gzip
authorization: Bearer mock
ocs-apirequest: true
GET http://localhost/ocs/v2\.php/apps/notifications/api/v2/notifications/2
GET http://localhost/ocs/v2\.php/apps/notifications/api/v2/notifications
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
accept-encoding: gzip
content-length: 0
authorization: Bearer mock
ocs-apirequest: true
GET http://localhost/ocs/v2\.php/apps/notifications/api/v2/notifications/[0-9]+
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
accept-encoding: gzip
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
DELETE http://localhost/ocs/v2\.php/apps/notifications/api/v2/notifications
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
accept-encoding: gzip
authorization: Bearer mock
ocs-apirequest: true
POST http://localhost/ocs/v2\.php/apps/notifications/api/v2/admin_notifications/admin\?shortMessage=123&longMessage=456
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
POST http://localhost/ocs/v2\.php/apps/spreed/api/v4/room\?roomType=1&invite=user2&roomName=&source=&objectType=&objectId=
POST http://localhost/ocs/v2\.php/apps/spreed/api/v4/room\?roomType=3&invite=&roomName=Test&source=&objectType=&objectId=
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
Expand All @@ -12,7 +12,7 @@ transfer-encoding: chunked
accept-encoding: gzip
authorization: Bearer mock
ocs-apirequest: true
POST http://localhost/ocs/v2\.php/apps/spreed/api/v1/chat/[a-z0-9]{8}\?message=123&actorDisplayName=&referenceId=&replyTo=2&silent=0
POST http://localhost/ocs/v2\.php/apps/spreed/api/v1/chat/[a-z0-9]{8}\?message=123&actorDisplayName=&referenceId=&replyTo=[0-9]+&silent=0
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ transfer-encoding: chunked
accept-encoding: gzip
authorization: Bearer mock
ocs-apirequest: true
GET http://localhost/ocs/v2\.php/apps/spreed/api/v1/chat/[a-z0-9]{8}\?lookIntoFuture=1&limit=100&lastKnownMessageId=2&lastCommonReadId=0&timeout=3&setReadMarker=1&includeLastKnown=0&noStatusUpdate=0&markNotificationsAsRead=1
GET http://localhost/ocs/v2\.php/apps/spreed/api/v1/chat/[a-z0-9]{8}\?lookIntoFuture=1&limit=100&lastKnownMessageId=[0-9]+&lastCommonReadId=0&timeout=3&setReadMarker=1&includeLastKnown=0&noStatusUpdate=0&markNotificationsAsRead=1
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
accept-encoding: gzip
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
POST http://localhost/ocs/v2\.php/apps/spreed/api/v4/room\?roomType=1&invite=user2&roomName=&source=&objectType=&objectId=
POST http://localhost/ocs/v2\.php/apps/spreed/api/v4/room\?roomType=3&invite=&roomName=Test&source=&objectType=&objectId=
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
POST http://localhost/ocs/v2\.php/apps/spreed/api/v4/room\?roomType=1&invite=user2&roomName=&source=&objectType=&objectId=
POST http://localhost/ocs/v2\.php/apps/spreed/api/v4/room\?roomType=3&invite=&roomName=Test&source=&objectType=&objectId=
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
PUT http://localhost/ocs/v2\.php/apps/user_status/api/v1/user_status/status\?statusType=online
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
accept-encoding: gzip
authorization: Bearer mock
ocs-apirequest: true
DELETE http://localhost/ocs/v2\.php/apps/user_status/api/v1/user_status/message
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
accept-encoding: gzip
authorization: Bearer mock
ocs-apirequest: true
PUT http://localhost/ocs/v2\.php/apps/user_status/api/v1/heartbeat\?status=online
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
GET http://localhost/ocs/v2\.php/apps/user_status/api/v1/statuses
PUT http://localhost/ocs/v2\.php/apps/user_status/api/v1/user_status/status\?statusType=online
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
accept-encoding: gzip
content-length: 0
authorization: Bearer mock
ocs-apirequest: true
PUT http://localhost/ocs/v2\.php/apps/user_status/api/v1/user_status/status\?statusType=online
DELETE http://localhost/ocs/v2\.php/apps/user_status/api/v1/user_status/message
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
PUT http://localhost/ocs/v2\.php/apps/user_status/api/v1/user_status/status\?statusType=online
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
accept-encoding: gzip
authorization: Bearer mock
ocs-apirequest: true
DELETE http://localhost/ocs/v2\.php/apps/user_status/api/v1/user_status/message
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
accept-encoding: gzip
authorization: Bearer mock
ocs-apirequest: true
PUT http://localhost/ocs/v2\.php/apps/user_status/api/v1/user_status/message/custom\?statusIcon=%F0%9F%98%80&message=bla&clearAt=[0-9]+
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ transfer-encoding: chunked
accept-encoding: gzip
authorization: Bearer mock
ocs-apirequest: true
DELETE http://localhost/ocs/v2\.php/apps/user_status/api/v1/user_status/message
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
accept-encoding: gzip
authorization: Bearer mock
ocs-apirequest: true
GET http://localhost/ocs/v2\.php/apps/user_status/api/v1/statuses/user1
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ transfer-encoding: chunked
accept-encoding: gzip
authorization: Bearer mock
ocs-apirequest: true
DELETE http://localhost/ocs/v2\.php/apps/user_status/api/v1/user_status/message
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
accept-encoding: gzip
authorization: Bearer mock
ocs-apirequest: true
GET http://localhost/ocs/v2\.php/apps/user_status/api/v1/user_status
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,18 @@ accept: application/json
transfer-encoding: chunked
accept-encoding: gzip
authorization: Bearer mock
ocs-apirequest: true
DELETE http://localhost/ocs/v2\.php/apps/user_status/api/v1/user_status/message
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
accept-encoding: gzip
authorization: Bearer mock
ocs-apirequest: true
PUT http://localhost/ocs/v2\.php/apps/user_status/api/v1/user_status/status\?statusType=online
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
accept-encoding: gzip
authorization: Bearer mock
ocs-apirequest: true
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
PUT http://localhost/ocs/v2\.php/apps/user_status/api/v1/user_status/status\?statusType=online
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
accept-encoding: gzip
authorization: Bearer mock
ocs-apirequest: true
DELETE http://localhost/ocs/v2\.php/apps/user_status/api/v1/user_status/message
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
transfer-encoding: chunked
accept-encoding: gzip
authorization: Bearer mock
ocs-apirequest: true
PUT http://localhost/ocs/v2\.php/apps/user_status/api/v1/user_status/message/custom\?statusIcon=%F0%9F%98%80&message=bla&clearAt=[0-9]+
user-agent: Dart/3\.2 \(dart:io\)
accept: application/json
Expand Down
Loading

0 comments on commit f2f236b

Please sign in to comment.