Added test for login page

This commit is contained in:
Anton Stubenbord
2022-12-05 19:15:00 +01:00
parent 0a63259693
commit d79682a011
20 changed files with 444 additions and 50 deletions

View File

@@ -2,6 +2,7 @@ import 'dart:io';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:encrypted_shared_preferences/encrypted_shared_preferences.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:paperless_api/paperless_api.dart';
import 'package:paperless_mobile/core/interceptor/authentication.interceptor.dart';
@@ -16,18 +17,33 @@ import 'package:local_auth/local_auth.dart';
@module
abstract class RegisterModule {
@singleton
@dev
@prod
LocalAuthentication get localAuthentication => LocalAuthentication();
@singleton
@dev
@prod
EncryptedSharedPreferences get encryptedSharedPreferences =>
EncryptedSharedPreferences();
@singleton
@dev
@prod
@test
SecurityContext get securityContext => SecurityContext();
@singleton
@dev
@prod
Connectivity get connectivity => Connectivity();
///
/// Factory method creating an [HttpClient] with the currently registered [SecurityContext].
///
@injectable
@dev
@prod
HttpClient getHttpClient(SecurityContext securityContext) =>
HttpClient(context: securityContext)
..connectionTimeout = const Duration(seconds: 10);
@@ -35,6 +51,9 @@ abstract class RegisterModule {
///
/// Factory method creating a [InterceptedClient] on top of the currently registered [HttpClient].
///
@injectable
@dev
@prod
BaseClient getBaseClient(
AuthenticationInterceptor authInterceptor,
ResponseConversionInterceptor responseConversionInterceptor,
@@ -50,28 +69,46 @@ abstract class RegisterModule {
client: IOClient(client),
);
@injectable
@dev
@prod
CacheManager getCacheManager(BaseClient client) => CacheManager(
Config('cacheKey', fileService: HttpFileService(httpClient: client)));
@injectable
@dev
@prod
PaperlessAuthenticationApi authenticationModule(BaseClient client) =>
PaperlessAuthenticationApiImpl(client);
@injectable
@dev
@prod
PaperlessLabelsApi labelsModule(
@Named('timeoutClient') BaseClient timeoutClient,
) =>
PaperlessLabelApiImpl(timeoutClient);
@injectable
@dev
@prod
PaperlessDocumentsApi documentsModule(
@Named('timeoutClient') BaseClient timeoutClient,
HttpClient httpClient,
) =>
PaperlessDocumentsApiImpl(timeoutClient, httpClient);
@injectable
@dev
@prod
PaperlessSavedViewsApi savedViewsModule(
@Named('timeoutClient') BaseClient timeoutClient,
) =>
PaperlessSavedViewsApiImpl(timeoutClient);
@injectable
@dev
@prod
PaperlessServerStatsApi serverStatsModule(
@Named('timeoutClient') BaseClient timeoutClient,
) =>