From 63cd10ac490d224248af2f38079506f8618dd8d5 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Thu, 28 Sep 2023 23:54:13 +0200 Subject: [PATCH] test(nextcloud): Test client login flow V2 Signed-off-by: jld3103 --- packages/nextcloud/test/core_test.dart | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/nextcloud/test/core_test.dart b/packages/nextcloud/test/core_test.dart index 5f4a6326..df5d05aa 100644 --- a/packages/nextcloud/test/core_test.dart +++ b/packages/nextcloud/test/core_test.dart @@ -184,6 +184,21 @@ void main() { expect(response.body.ocs.data.entries.single.rounded, isFalse); expect(response.body.ocs.data.entries.single.attributes, isEmpty); }); + + test('Client login flow V2', () async { + final response = await client.core.clientFlowLoginV2.init(); + expect(response.statusCode, 200); + expect(() => response.headers, isA()); + + expect(response.body.login, startsWith('http://localhost')); + expect(response.body.poll.endpoint, startsWith('http://localhost')); + expect(response.body.poll.token, isNotEmpty); + + expect( + () => client.core.clientFlowLoginV2.poll(token: response.body.poll.token), + throwsA(predicate((final e) => e.statusCode == 404)), + ); + }); }, retry: retryCount, timeout: timeout,