fix: API 응답 파싱 오류 수정 및 에러 처리 개선
주요 변경사항: - 창고 관리 API 응답 구조와 DTO 불일치 수정 - WarehouseLocationDto에 code, manager_phone 필드 추가 - RemoteDataSource에서 API 응답을 DTO 구조에 맞게 변환 - 회사 관리 API 응답 파싱 오류 수정 - CompanyResponse의 필수 필드를 nullable로 변경 - PaginatedResponse 구조 매핑 로직 개선 - 에러 처리 및 로깅 개선 - Service Layer에 상세 에러 로깅 추가 - Controller에서 에러 타입별 처리 - 새로운 유틸리티 추가 - ResponseInterceptor: API 응답 정규화 - DebugLogger: 디버깅 도구 - HealthCheckService: 서버 상태 확인 - 문서화 - API 통합 테스트 가이드 - 에러 분석 보고서 - 리팩토링 계획서
This commit is contained in:
326
test/api/api_error_diagnosis_test.dart
Normal file
326
test/api/api_error_diagnosis_test.dart
Normal file
@@ -0,0 +1,326 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:superport/core/utils/debug_logger.dart';
|
||||
import 'package:superport/core/utils/login_diagnostics.dart';
|
||||
import 'package:superport/data/models/auth/login_response.dart';
|
||||
import 'package:superport/data/models/auth/auth_user.dart';
|
||||
|
||||
/// API 에러 진단을 위한 테스트
|
||||
/// 실제 API 호출 시 발생하는 타입 에러와 응답 형식 문제를 파악합니다.
|
||||
void main() {
|
||||
group('API 응답 형식 및 타입 에러 진단', () {
|
||||
test('로그인 응답 JSON 파싱 - snake_case 필드명', () {
|
||||
// API가 snake_case로 응답하는 경우
|
||||
final snakeCaseResponse = {
|
||||
'access_token': 'test_token_123',
|
||||
'refresh_token': 'refresh_token_456',
|
||||
'token_type': 'Bearer',
|
||||
'expires_in': 3600,
|
||||
'user': {
|
||||
'id': 1,
|
||||
'username': 'testuser',
|
||||
'email': 'test@example.com',
|
||||
'name': '테스트 사용자',
|
||||
'role': 'USER',
|
||||
},
|
||||
};
|
||||
|
||||
// 파싱 시도
|
||||
try {
|
||||
final loginResponse = LoginResponse.fromJson(snakeCaseResponse);
|
||||
print('[성공] snake_case 응답 파싱 성공');
|
||||
print('Access Token: ${loginResponse.accessToken}');
|
||||
print('User Email: ${loginResponse.user.email}');
|
||||
|
||||
// 검증
|
||||
expect(loginResponse.accessToken, 'test_token_123');
|
||||
expect(loginResponse.refreshToken, 'refresh_token_456');
|
||||
expect(loginResponse.user.email, 'test@example.com');
|
||||
} catch (e, stackTrace) {
|
||||
print('[실패] snake_case 응답 파싱 실패');
|
||||
print('에러: $e');
|
||||
print('스택 트레이스: $stackTrace');
|
||||
fail('snake_case 응답 파싱에 실패했습니다: $e');
|
||||
}
|
||||
});
|
||||
|
||||
test('로그인 응답 JSON 파싱 - camelCase 필드명', () {
|
||||
// API가 camelCase로 응답하는 경우
|
||||
final camelCaseResponse = {
|
||||
'accessToken': 'test_token_123',
|
||||
'refreshToken': 'refresh_token_456',
|
||||
'tokenType': 'Bearer',
|
||||
'expiresIn': 3600,
|
||||
'user': {
|
||||
'id': 1,
|
||||
'username': 'testuser',
|
||||
'email': 'test@example.com',
|
||||
'name': '테스트 사용자',
|
||||
'role': 'USER',
|
||||
},
|
||||
};
|
||||
|
||||
// 파싱 시도
|
||||
try {
|
||||
final loginResponse = LoginResponse.fromJson(camelCaseResponse);
|
||||
print('[성공] camelCase 응답 파싱 성공');
|
||||
print('Access Token: ${loginResponse.accessToken}');
|
||||
|
||||
// 이 테스트는 실패할 것으로 예상됨 (현재 모델이 snake_case 기준)
|
||||
fail('camelCase 응답이 성공하면 안됩니다 (모델이 snake_case 기준)');
|
||||
} catch (e) {
|
||||
print('[예상된 실패] camelCase 응답 파싱 실패 (정상)');
|
||||
print('에러: $e');
|
||||
// 이는 예상된 동작임
|
||||
expect(e, isNotNull);
|
||||
}
|
||||
});
|
||||
|
||||
test('다양한 API 응답 형식 처리 테스트', () {
|
||||
// 테스트 케이스들
|
||||
final testCases = [
|
||||
{
|
||||
'name': '형식 1: success/data 래핑',
|
||||
'response': {
|
||||
'success': true,
|
||||
'data': {
|
||||
'access_token': 'token1',
|
||||
'refresh_token': 'refresh1',
|
||||
'token_type': 'Bearer',
|
||||
'expires_in': 3600,
|
||||
'user': {
|
||||
'id': 1,
|
||||
'username': 'user1',
|
||||
'email': 'user1@test.com',
|
||||
'name': '사용자1',
|
||||
'role': 'USER',
|
||||
},
|
||||
},
|
||||
},
|
||||
'expectSuccess': false, // 직접 파싱은 실패해야 함
|
||||
},
|
||||
{
|
||||
'name': '형식 2: 직접 응답',
|
||||
'response': {
|
||||
'access_token': 'token2',
|
||||
'refresh_token': 'refresh2',
|
||||
'token_type': 'Bearer',
|
||||
'expires_in': 3600,
|
||||
'user': {
|
||||
'id': 2,
|
||||
'username': 'user2',
|
||||
'email': 'user2@test.com',
|
||||
'name': '사용자2',
|
||||
'role': 'ADMIN',
|
||||
},
|
||||
},
|
||||
'expectSuccess': true,
|
||||
},
|
||||
{
|
||||
'name': '형식 3: 필수 필드 누락',
|
||||
'response': {
|
||||
'access_token': 'token3',
|
||||
// refresh_token 누락
|
||||
'token_type': 'Bearer',
|
||||
'expires_in': 3600,
|
||||
'user': {
|
||||
'id': 3,
|
||||
'username': 'user3',
|
||||
'email': 'user3@test.com',
|
||||
'name': '사용자3',
|
||||
'role': 'USER',
|
||||
},
|
||||
},
|
||||
'expectSuccess': false,
|
||||
},
|
||||
];
|
||||
|
||||
for (final testCase in testCases) {
|
||||
print('\n테스트: ${testCase['name']}');
|
||||
final response = testCase['response'] as Map<String, dynamic>;
|
||||
final expectSuccess = testCase['expectSuccess'] as bool;
|
||||
|
||||
try {
|
||||
final loginResponse = LoginResponse.fromJson(response);
|
||||
if (expectSuccess) {
|
||||
print('✅ 파싱 성공 (예상대로)');
|
||||
expect(loginResponse.accessToken, isNotNull);
|
||||
} else {
|
||||
print('❌ 파싱 성공 (실패해야 하는데 성공함)');
|
||||
fail('${testCase['name']} - 파싱이 실패해야 하는데 성공했습니다');
|
||||
}
|
||||
} catch (e) {
|
||||
if (!expectSuccess) {
|
||||
print('✅ 파싱 실패 (예상대로): $e');
|
||||
} else {
|
||||
print('❌ 파싱 실패 (성공해야 하는데 실패함): $e');
|
||||
fail('${testCase['name']} - 파싱이 성공해야 하는데 실패했습니다: $e');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('AuthUser 모델 파싱 테스트', () {
|
||||
final testUser = {
|
||||
'id': 100,
|
||||
'username': 'johndoe',
|
||||
'email': 'john@example.com',
|
||||
'name': 'John Doe',
|
||||
'role': 'ADMIN',
|
||||
};
|
||||
|
||||
try {
|
||||
final user = AuthUser.fromJson(testUser);
|
||||
expect(user.id, 100);
|
||||
expect(user.username, 'johndoe');
|
||||
expect(user.email, 'john@example.com');
|
||||
expect(user.name, 'John Doe');
|
||||
expect(user.role, 'ADMIN');
|
||||
print('✅ AuthUser 파싱 성공');
|
||||
} catch (e) {
|
||||
fail('AuthUser 파싱 실패: $e');
|
||||
}
|
||||
});
|
||||
|
||||
test('실제 API 응답 시뮬레이션', () async {
|
||||
// 실제 API가 반환할 수 있는 다양한 응답들
|
||||
final possibleResponses = [
|
||||
// Spring Boot 기본 응답
|
||||
Response(
|
||||
data: {
|
||||
'timestamp': '2024-01-31T10:00:00',
|
||||
'status': 200,
|
||||
'data': {
|
||||
'access_token': 'jwt_token_here',
|
||||
'refresh_token': 'refresh_token_here',
|
||||
'token_type': 'Bearer',
|
||||
'expires_in': 3600,
|
||||
'user': {
|
||||
'id': 1,
|
||||
'username': 'admin',
|
||||
'email': 'admin@superport.com',
|
||||
'name': '관리자',
|
||||
'role': 'ADMIN',
|
||||
},
|
||||
},
|
||||
},
|
||||
statusCode: 200,
|
||||
requestOptions: RequestOptions(path: '/auth/login'),
|
||||
),
|
||||
// FastAPI 스타일 응답
|
||||
Response(
|
||||
data: {
|
||||
'access_token': 'jwt_token_here',
|
||||
'refresh_token': 'refresh_token_here',
|
||||
'token_type': 'bearer',
|
||||
'expires_in': 3600,
|
||||
'user': {
|
||||
'id': 1,
|
||||
'username': 'admin',
|
||||
'email': 'admin@superport.com',
|
||||
'name': '관리자',
|
||||
'role': 'ADMIN',
|
||||
},
|
||||
},
|
||||
statusCode: 200,
|
||||
requestOptions: RequestOptions(path: '/auth/login'),
|
||||
),
|
||||
];
|
||||
|
||||
for (var i = 0; i < possibleResponses.length; i++) {
|
||||
final response = possibleResponses[i];
|
||||
print('\n응답 형식 ${i + 1} 테스트:');
|
||||
print('응답 데이터: ${response.data}');
|
||||
|
||||
// ResponseInterceptor 시뮬레이션
|
||||
if (response.data is Map<String, dynamic>) {
|
||||
final data = response.data as Map<String, dynamic>;
|
||||
|
||||
// 이미 정규화된 형식인지 확인
|
||||
if (data.containsKey('success') && data.containsKey('data')) {
|
||||
print('이미 정규화된 형식');
|
||||
try {
|
||||
final loginResponse = LoginResponse.fromJson(data['data']);
|
||||
print('✅ 정규화된 형식 파싱 성공');
|
||||
} catch (e) {
|
||||
print('❌ 정규화된 형식 파싱 실패: $e');
|
||||
}
|
||||
} else if (data.containsKey('access_token') || data.containsKey('accessToken')) {
|
||||
print('직접 데이터 형식 - 정규화 필요');
|
||||
// 정규화
|
||||
final normalizedData = {
|
||||
'success': true,
|
||||
'data': data,
|
||||
};
|
||||
try {
|
||||
final loginResponse = LoginResponse.fromJson(normalizedData['data'] as Map<String, dynamic>);
|
||||
print('✅ 직접 데이터 형식 파싱 성공');
|
||||
} catch (e) {
|
||||
print('❌ 직접 데이터 형식 파싱 실패: $e');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
group('로그인 진단 도구 테스트', () {
|
||||
test('전체 진단 실행', () async {
|
||||
print('\n=== 로그인 진단 시작 ===\n');
|
||||
|
||||
final diagnostics = await LoginDiagnostics.runFullDiagnostics();
|
||||
final report = LoginDiagnostics.formatDiagnosticsReport(diagnostics);
|
||||
|
||||
print(report);
|
||||
|
||||
// 진단 결과 검증
|
||||
expect(diagnostics, isNotNull);
|
||||
expect(diagnostics['environment'], isNotNull);
|
||||
expect(diagnostics['serialization'], isNotNull);
|
||||
|
||||
// 직렬화 테스트 결과 확인
|
||||
final serialization = diagnostics['serialization'] as Map<String, dynamic>;
|
||||
expect(serialization['loginRequestValid'], true);
|
||||
expect(serialization['format1Valid'], true);
|
||||
expect(serialization['format2Valid'], true);
|
||||
});
|
||||
|
||||
test('DebugLogger 기능 테스트', () {
|
||||
// API 요청 로깅
|
||||
DebugLogger.logApiRequest(
|
||||
method: 'POST',
|
||||
url: '/auth/login',
|
||||
data: {'email': 'test@example.com', 'password': '***'},
|
||||
);
|
||||
|
||||
// API 응답 로깅
|
||||
DebugLogger.logApiResponse(
|
||||
url: '/auth/login',
|
||||
statusCode: 200,
|
||||
data: {'success': true},
|
||||
);
|
||||
|
||||
// 에러 로깅
|
||||
DebugLogger.logError(
|
||||
'API 호출 실패',
|
||||
error: Exception('Network error'),
|
||||
additionalData: {'endpoint': '/auth/login'},
|
||||
);
|
||||
|
||||
// JSON 파싱 로깅
|
||||
final testJson = {
|
||||
'id': 1,
|
||||
'name': 'Test',
|
||||
};
|
||||
|
||||
final result = DebugLogger.parseJsonWithLogging(
|
||||
testJson,
|
||||
(json) => json,
|
||||
objectName: 'TestObject',
|
||||
);
|
||||
|
||||
expect(result, isNotNull);
|
||||
expect(result, equals(testJson));
|
||||
});
|
||||
});
|
||||
}
|
||||
339
test/api/auth_api_integration_test.dart
Normal file
339
test/api/auth_api_integration_test.dart
Normal file
@@ -0,0 +1,339 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:superport/data/datasources/remote/api_client.dart';
|
||||
import 'package:superport/data/datasources/remote/auth_remote_datasource.dart';
|
||||
import 'package:superport/data/models/auth/login_request.dart';
|
||||
import 'package:superport/data/models/auth/login_response.dart';
|
||||
import 'package:superport/data/models/auth/auth_user.dart';
|
||||
import 'package:superport/core/errors/failures.dart';
|
||||
import 'package:superport/core/utils/debug_logger.dart';
|
||||
|
||||
import 'auth_api_integration_test.mocks.dart';
|
||||
|
||||
@GenerateMocks([Dio])
|
||||
void main() {
|
||||
group('Auth API 통합 테스트 - 실제 API 동작 시뮬레이션', () {
|
||||
late MockDio mockDio;
|
||||
late ApiClient apiClient;
|
||||
late AuthRemoteDataSource authDataSource;
|
||||
|
||||
setUp(() {
|
||||
mockDio = MockDio();
|
||||
// ApiClient를 직접 생성하는 대신 mockDio를 주입
|
||||
apiClient = ApiClient();
|
||||
// Reflection을 사용해 private _dio 필드에 접근 (테스트 목적)
|
||||
// 실제로는 ApiClient에 테스트용 생성자를 추가하는 것이 좋음
|
||||
authDataSource = AuthRemoteDataSourceImpl(apiClient);
|
||||
});
|
||||
|
||||
test('Case 1: API가 success/data 형식으로 응답하는 경우', () async {
|
||||
// Arrange
|
||||
final request = LoginRequest(
|
||||
email: 'admin@superport.com',
|
||||
password: 'admin123',
|
||||
);
|
||||
|
||||
final apiResponse = {
|
||||
'success': true,
|
||||
'data': {
|
||||
'access_token': 'jwt_token_123456',
|
||||
'refresh_token': 'refresh_token_789',
|
||||
'token_type': 'Bearer',
|
||||
'expires_in': 3600,
|
||||
'user': {
|
||||
'id': 1,
|
||||
'username': 'admin',
|
||||
'email': 'admin@superport.com',
|
||||
'name': '시스템 관리자',
|
||||
'role': 'ADMIN',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// Act & Assert
|
||||
print('\n=== Case 1: success/data 래핑 형식 ===');
|
||||
print('요청 데이터: ${request.toJson()}');
|
||||
print('예상 응답: $apiResponse');
|
||||
|
||||
// 실제 API 호출 시뮬레이션
|
||||
try {
|
||||
// AuthRemoteDataSourceImpl의 로직 검증
|
||||
final responseData = apiResponse;
|
||||
|
||||
if (responseData['success'] == true && responseData['data'] != null) {
|
||||
print('✅ 응답 형식 1 감지 (success/data 래핑)');
|
||||
|
||||
final loginData = responseData['data'] as Map<String, dynamic>;
|
||||
final loginResponse = LoginResponse.fromJson(loginData);
|
||||
|
||||
print('파싱 성공:');
|
||||
print(' - Access Token: ${loginResponse.accessToken}');
|
||||
print(' - User Email: ${loginResponse.user.email}');
|
||||
print(' - User Role: ${loginResponse.user.role}');
|
||||
|
||||
expect(loginResponse.accessToken, 'jwt_token_123456');
|
||||
expect(loginResponse.user.email, 'admin@superport.com');
|
||||
expect(loginResponse.user.role, 'ADMIN');
|
||||
}
|
||||
} catch (e, stackTrace) {
|
||||
print('❌ 파싱 실패: $e');
|
||||
print('스택 트레이스: $stackTrace');
|
||||
fail('success/data 형식 파싱에 실패했습니다');
|
||||
}
|
||||
});
|
||||
|
||||
test('Case 2: API가 직접 LoginResponse 형식으로 응답하는 경우', () async {
|
||||
// Arrange
|
||||
final request = LoginRequest(
|
||||
username: 'testuser',
|
||||
password: 'password123',
|
||||
);
|
||||
|
||||
final apiResponse = {
|
||||
'access_token': 'direct_token_456',
|
||||
'refresh_token': 'direct_refresh_789',
|
||||
'token_type': 'Bearer',
|
||||
'expires_in': 7200,
|
||||
'user': {
|
||||
'id': 2,
|
||||
'username': 'testuser',
|
||||
'email': 'test@example.com',
|
||||
'name': '일반 사용자',
|
||||
'role': 'USER',
|
||||
},
|
||||
};
|
||||
|
||||
// Act & Assert
|
||||
print('\n=== Case 2: 직접 응답 형식 ===');
|
||||
print('요청 데이터: ${request.toJson()}');
|
||||
print('예상 응답: $apiResponse');
|
||||
|
||||
try {
|
||||
// 직접 응답 형식 처리
|
||||
if (apiResponse.containsKey('access_token')) {
|
||||
print('✅ 응답 형식 2 감지 (직접 응답)');
|
||||
|
||||
final loginResponse = LoginResponse.fromJson(apiResponse);
|
||||
|
||||
print('파싱 성공:');
|
||||
print(' - Access Token: ${loginResponse.accessToken}');
|
||||
print(' - User Username: ${loginResponse.user.username}');
|
||||
print(' - User Role: ${loginResponse.user.role}');
|
||||
|
||||
expect(loginResponse.accessToken, 'direct_token_456');
|
||||
expect(loginResponse.user.username, 'testuser');
|
||||
expect(loginResponse.user.role, 'USER');
|
||||
}
|
||||
} catch (e, stackTrace) {
|
||||
print('❌ 파싱 실패: $e');
|
||||
print('스택 트레이스: $stackTrace');
|
||||
fail('직접 응답 형식 파싱에 실패했습니다');
|
||||
}
|
||||
});
|
||||
|
||||
test('Case 3: camelCase 필드명 사용 시 에러', () async {
|
||||
// Arrange
|
||||
final apiResponse = {
|
||||
'accessToken': 'camel_token_123', // camelCase
|
||||
'refreshToken': 'camel_refresh_456',
|
||||
'tokenType': 'Bearer',
|
||||
'expiresIn': 3600,
|
||||
'user': {
|
||||
'id': 3,
|
||||
'username': 'cameluser',
|
||||
'email': 'camel@test.com',
|
||||
'name': 'Camel User',
|
||||
'role': 'USER',
|
||||
},
|
||||
};
|
||||
|
||||
// Act & Assert
|
||||
print('\n=== Case 3: camelCase 필드명 에러 ===');
|
||||
print('예상 응답: $apiResponse');
|
||||
|
||||
try {
|
||||
final loginResponse = LoginResponse.fromJson(apiResponse);
|
||||
fail('camelCase 응답이 성공하면 안됩니다');
|
||||
} catch (e) {
|
||||
print('✅ 예상된 에러 발생: $e');
|
||||
expect(e.toString(), contains('type \'Null\' is not a subtype of type \'String\''));
|
||||
}
|
||||
});
|
||||
|
||||
test('Case 4: 401 인증 실패 응답', () async {
|
||||
// Arrange
|
||||
final request = LoginRequest(
|
||||
email: 'wrong@email.com',
|
||||
password: 'wrongpassword',
|
||||
);
|
||||
|
||||
// Act & Assert
|
||||
print('\n=== Case 4: 401 인증 실패 ===');
|
||||
print('요청 데이터: ${request.toJson()}');
|
||||
|
||||
// DioException 시뮬레이션
|
||||
final dioError = DioException(
|
||||
response: Response(
|
||||
statusCode: 401,
|
||||
data: {
|
||||
'message': 'Invalid credentials',
|
||||
'error': 'Unauthorized',
|
||||
},
|
||||
requestOptions: RequestOptions(path: '/auth/login'),
|
||||
),
|
||||
requestOptions: RequestOptions(path: '/auth/login'),
|
||||
type: DioExceptionType.badResponse,
|
||||
);
|
||||
|
||||
print('응답 상태: 401 Unauthorized');
|
||||
print('에러 메시지: Invalid credentials');
|
||||
|
||||
// AuthRemoteDataSourceImpl의 에러 처리 로직 검증
|
||||
expect(dioError.response?.statusCode, 401);
|
||||
|
||||
// 예상되는 Failure 타입
|
||||
print('✅ AuthenticationFailure로 변환되어야 함');
|
||||
});
|
||||
|
||||
test('Case 5: 네트워크 타임아웃', () async {
|
||||
// Arrange
|
||||
final request = LoginRequest(
|
||||
email: 'test@example.com',
|
||||
password: 'password',
|
||||
);
|
||||
|
||||
// Act & Assert
|
||||
print('\n=== Case 5: 네트워크 타임아웃 ===');
|
||||
print('요청 데이터: ${request.toJson()}');
|
||||
|
||||
final dioError = DioException(
|
||||
requestOptions: RequestOptions(path: '/auth/login'),
|
||||
type: DioExceptionType.connectionTimeout,
|
||||
message: 'Connection timeout',
|
||||
);
|
||||
|
||||
print('에러 타입: ${dioError.type}');
|
||||
print('에러 메시지: ${dioError.message}');
|
||||
|
||||
// 예상되는 Failure 타입
|
||||
print('✅ NetworkFailure로 변환되어야 함');
|
||||
});
|
||||
|
||||
test('Case 6: 잘못된 JSON 응답', () async {
|
||||
// Arrange
|
||||
final apiResponse = {
|
||||
'error': 'Invalid request',
|
||||
'status': 'failed',
|
||||
// access_token 등 필수 필드 누락
|
||||
};
|
||||
|
||||
// Act & Assert
|
||||
print('\n=== Case 6: 잘못된 JSON 응답 ===');
|
||||
print('예상 응답: $apiResponse');
|
||||
|
||||
try {
|
||||
final loginResponse = LoginResponse.fromJson(apiResponse);
|
||||
fail('잘못된 JSON이 파싱되면 안됩니다');
|
||||
} catch (e) {
|
||||
print('✅ 예상된 에러 발생: $e');
|
||||
expect(e.toString(), contains('type \'Null\' is not a subtype'));
|
||||
}
|
||||
});
|
||||
|
||||
test('Case 7: ResponseInterceptor 동작 검증', () async {
|
||||
// ResponseInterceptor가 다양한 응답을 어떻게 처리하는지 검증
|
||||
print('\n=== Case 7: ResponseInterceptor 동작 검증 ===');
|
||||
|
||||
final testCases = [
|
||||
{
|
||||
'name': '이미 정규화된 응답',
|
||||
'input': {
|
||||
'success': true,
|
||||
'data': {'access_token': 'token1'},
|
||||
},
|
||||
'expected': {
|
||||
'success': true,
|
||||
'data': {'access_token': 'token1'},
|
||||
},
|
||||
},
|
||||
{
|
||||
'name': '직접 데이터 응답 (access_token)',
|
||||
'input': {
|
||||
'access_token': 'token2',
|
||||
'user': {'id': 1},
|
||||
},
|
||||
'expected': {
|
||||
'success': true,
|
||||
'data': {
|
||||
'access_token': 'token2',
|
||||
'user': {'id': 1},
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
for (final testCase in testCases) {
|
||||
print('\n테스트: ${testCase['name']}');
|
||||
print('입력: ${testCase['input']}');
|
||||
print('예상 출력: ${testCase['expected']}');
|
||||
|
||||
// ResponseInterceptor 로직 시뮬레이션
|
||||
final input = testCase['input'] as Map<String, dynamic>;
|
||||
Map<String, dynamic> output;
|
||||
|
||||
if (input.containsKey('success') && input.containsKey('data')) {
|
||||
output = input; // 이미 정규화됨
|
||||
} else if (input.containsKey('access_token') || input.containsKey('accessToken')) {
|
||||
output = {
|
||||
'success': true,
|
||||
'data': input,
|
||||
};
|
||||
} else {
|
||||
output = input;
|
||||
}
|
||||
|
||||
print('실제 출력: $output');
|
||||
expect(output, equals(testCase['expected']));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
group('에러 메시지 및 스택 트레이스 분석', () {
|
||||
test('실제 에러 시나리오 재현', () {
|
||||
print('\n=== 실제 에러 시나리오 재현 ===\n');
|
||||
|
||||
// 테스트에서 발생한 실제 에러들
|
||||
final errors = [
|
||||
{
|
||||
'scenario': 'Future.timeout 타입 에러',
|
||||
'error': "type '() => Left<Failure, LoginResponse>' is not a subtype of type '(() => FutureOr<Right<Failure, LoginResponse>>)?'",
|
||||
'cause': 'timeout의 onTimeout 콜백이 잘못된 타입을 반환',
|
||||
'solution': 'onTimeout이 Future<Either<Failure, LoginResponse>>를 반환하도록 수정',
|
||||
},
|
||||
{
|
||||
'scenario': 'JSON 파싱 null 에러',
|
||||
'error': "type 'Null' is not a subtype of type 'String' in type cast",
|
||||
'cause': 'snake_case 필드명 기대하지만 camelCase로 전달됨',
|
||||
'solution': 'API 응답 형식 확인 및 모델 수정',
|
||||
},
|
||||
{
|
||||
'scenario': '위젯 테스트 tap 실패',
|
||||
'error': "could not be tapped on because it has not been laid out yet",
|
||||
'cause': '위젯이 아직 렌더링되지 않은 상태에서 tap 시도',
|
||||
'solution': 'await tester.pumpAndSettle() 추가',
|
||||
},
|
||||
];
|
||||
|
||||
for (final error in errors) {
|
||||
print('시나리오: ${error['scenario']}');
|
||||
print('에러: ${error['error']}');
|
||||
print('원인: ${error['cause']}');
|
||||
print('해결책: ${error['solution']}');
|
||||
print('---\n');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
836
test/api/auth_api_integration_test.mocks.dart
Normal file
836
test/api/auth_api_integration_test.mocks.dart
Normal file
@@ -0,0 +1,836 @@
|
||||
// Mocks generated by Mockito 5.4.5 from annotations
|
||||
// in superport/test/api/auth_api_integration_test.dart.
|
||||
// Do not manually edit this file.
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i8;
|
||||
|
||||
import 'package:dio/src/adapter.dart' as _i3;
|
||||
import 'package:dio/src/cancel_token.dart' as _i9;
|
||||
import 'package:dio/src/dio.dart' as _i7;
|
||||
import 'package:dio/src/dio_mixin.dart' as _i5;
|
||||
import 'package:dio/src/options.dart' as _i2;
|
||||
import 'package:dio/src/response.dart' as _i6;
|
||||
import 'package:dio/src/transformer.dart' as _i4;
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: avoid_redundant_argument_values
|
||||
// ignore_for_file: avoid_setters_without_getters
|
||||
// ignore_for_file: comment_references
|
||||
// ignore_for_file: deprecated_member_use
|
||||
// ignore_for_file: deprecated_member_use_from_same_package
|
||||
// ignore_for_file: implementation_imports
|
||||
// ignore_for_file: invalid_use_of_visible_for_testing_member
|
||||
// ignore_for_file: must_be_immutable
|
||||
// ignore_for_file: prefer_const_constructors
|
||||
// ignore_for_file: unnecessary_parenthesis
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: subtype_of_sealed_class
|
||||
|
||||
class _FakeBaseOptions_0 extends _i1.SmartFake implements _i2.BaseOptions {
|
||||
_FakeBaseOptions_0(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
) : super(
|
||||
parent,
|
||||
parentInvocation,
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeHttpClientAdapter_1 extends _i1.SmartFake
|
||||
implements _i3.HttpClientAdapter {
|
||||
_FakeHttpClientAdapter_1(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
) : super(
|
||||
parent,
|
||||
parentInvocation,
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeTransformer_2 extends _i1.SmartFake implements _i4.Transformer {
|
||||
_FakeTransformer_2(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
) : super(
|
||||
parent,
|
||||
parentInvocation,
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeInterceptors_3 extends _i1.SmartFake implements _i5.Interceptors {
|
||||
_FakeInterceptors_3(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
) : super(
|
||||
parent,
|
||||
parentInvocation,
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeResponse_4<T1> extends _i1.SmartFake implements _i6.Response<T1> {
|
||||
_FakeResponse_4(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
) : super(
|
||||
parent,
|
||||
parentInvocation,
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeDio_5 extends _i1.SmartFake implements _i7.Dio {
|
||||
_FakeDio_5(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
) : super(
|
||||
parent,
|
||||
parentInvocation,
|
||||
);
|
||||
}
|
||||
|
||||
/// A class which mocks [Dio].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockDio extends _i1.Mock implements _i7.Dio {
|
||||
MockDio() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_i2.BaseOptions get options => (super.noSuchMethod(
|
||||
Invocation.getter(#options),
|
||||
returnValue: _FakeBaseOptions_0(
|
||||
this,
|
||||
Invocation.getter(#options),
|
||||
),
|
||||
) as _i2.BaseOptions);
|
||||
|
||||
@override
|
||||
set options(_i2.BaseOptions? _options) => super.noSuchMethod(
|
||||
Invocation.setter(
|
||||
#options,
|
||||
_options,
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
_i3.HttpClientAdapter get httpClientAdapter => (super.noSuchMethod(
|
||||
Invocation.getter(#httpClientAdapter),
|
||||
returnValue: _FakeHttpClientAdapter_1(
|
||||
this,
|
||||
Invocation.getter(#httpClientAdapter),
|
||||
),
|
||||
) as _i3.HttpClientAdapter);
|
||||
|
||||
@override
|
||||
set httpClientAdapter(_i3.HttpClientAdapter? _httpClientAdapter) =>
|
||||
super.noSuchMethod(
|
||||
Invocation.setter(
|
||||
#httpClientAdapter,
|
||||
_httpClientAdapter,
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
_i4.Transformer get transformer => (super.noSuchMethod(
|
||||
Invocation.getter(#transformer),
|
||||
returnValue: _FakeTransformer_2(
|
||||
this,
|
||||
Invocation.getter(#transformer),
|
||||
),
|
||||
) as _i4.Transformer);
|
||||
|
||||
@override
|
||||
set transformer(_i4.Transformer? _transformer) => super.noSuchMethod(
|
||||
Invocation.setter(
|
||||
#transformer,
|
||||
_transformer,
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
_i5.Interceptors get interceptors => (super.noSuchMethod(
|
||||
Invocation.getter(#interceptors),
|
||||
returnValue: _FakeInterceptors_3(
|
||||
this,
|
||||
Invocation.getter(#interceptors),
|
||||
),
|
||||
) as _i5.Interceptors);
|
||||
|
||||
@override
|
||||
void close({bool? force = false}) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#close,
|
||||
[],
|
||||
{#force: force},
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
_i8.Future<_i6.Response<T>> head<T>(
|
||||
String? path, {
|
||||
Object? data,
|
||||
Map<String, dynamic>? queryParameters,
|
||||
_i2.Options? options,
|
||||
_i9.CancelToken? cancelToken,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#head,
|
||||
[path],
|
||||
{
|
||||
#data: data,
|
||||
#queryParameters: queryParameters,
|
||||
#options: options,
|
||||
#cancelToken: cancelToken,
|
||||
},
|
||||
),
|
||||
returnValue: _i8.Future<_i6.Response<T>>.value(_FakeResponse_4<T>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#head,
|
||||
[path],
|
||||
{
|
||||
#data: data,
|
||||
#queryParameters: queryParameters,
|
||||
#options: options,
|
||||
#cancelToken: cancelToken,
|
||||
},
|
||||
),
|
||||
)),
|
||||
) as _i8.Future<_i6.Response<T>>);
|
||||
|
||||
@override
|
||||
_i8.Future<_i6.Response<T>> headUri<T>(
|
||||
Uri? uri, {
|
||||
Object? data,
|
||||
_i2.Options? options,
|
||||
_i9.CancelToken? cancelToken,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#headUri,
|
||||
[uri],
|
||||
{
|
||||
#data: data,
|
||||
#options: options,
|
||||
#cancelToken: cancelToken,
|
||||
},
|
||||
),
|
||||
returnValue: _i8.Future<_i6.Response<T>>.value(_FakeResponse_4<T>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#headUri,
|
||||
[uri],
|
||||
{
|
||||
#data: data,
|
||||
#options: options,
|
||||
#cancelToken: cancelToken,
|
||||
},
|
||||
),
|
||||
)),
|
||||
) as _i8.Future<_i6.Response<T>>);
|
||||
|
||||
@override
|
||||
_i8.Future<_i6.Response<T>> get<T>(
|
||||
String? path, {
|
||||
Object? data,
|
||||
Map<String, dynamic>? queryParameters,
|
||||
_i2.Options? options,
|
||||
_i9.CancelToken? cancelToken,
|
||||
_i2.ProgressCallback? onReceiveProgress,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#get,
|
||||
[path],
|
||||
{
|
||||
#data: data,
|
||||
#queryParameters: queryParameters,
|
||||
#options: options,
|
||||
#cancelToken: cancelToken,
|
||||
#onReceiveProgress: onReceiveProgress,
|
||||
},
|
||||
),
|
||||
returnValue: _i8.Future<_i6.Response<T>>.value(_FakeResponse_4<T>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#get,
|
||||
[path],
|
||||
{
|
||||
#data: data,
|
||||
#queryParameters: queryParameters,
|
||||
#options: options,
|
||||
#cancelToken: cancelToken,
|
||||
#onReceiveProgress: onReceiveProgress,
|
||||
},
|
||||
),
|
||||
)),
|
||||
) as _i8.Future<_i6.Response<T>>);
|
||||
|
||||
@override
|
||||
_i8.Future<_i6.Response<T>> getUri<T>(
|
||||
Uri? uri, {
|
||||
Object? data,
|
||||
_i2.Options? options,
|
||||
_i9.CancelToken? cancelToken,
|
||||
_i2.ProgressCallback? onReceiveProgress,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getUri,
|
||||
[uri],
|
||||
{
|
||||
#data: data,
|
||||
#options: options,
|
||||
#cancelToken: cancelToken,
|
||||
#onReceiveProgress: onReceiveProgress,
|
||||
},
|
||||
),
|
||||
returnValue: _i8.Future<_i6.Response<T>>.value(_FakeResponse_4<T>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#getUri,
|
||||
[uri],
|
||||
{
|
||||
#data: data,
|
||||
#options: options,
|
||||
#cancelToken: cancelToken,
|
||||
#onReceiveProgress: onReceiveProgress,
|
||||
},
|
||||
),
|
||||
)),
|
||||
) as _i8.Future<_i6.Response<T>>);
|
||||
|
||||
@override
|
||||
_i8.Future<_i6.Response<T>> post<T>(
|
||||
String? path, {
|
||||
Object? data,
|
||||
Map<String, dynamic>? queryParameters,
|
||||
_i2.Options? options,
|
||||
_i9.CancelToken? cancelToken,
|
||||
_i2.ProgressCallback? onSendProgress,
|
||||
_i2.ProgressCallback? onReceiveProgress,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#post,
|
||||
[path],
|
||||
{
|
||||
#data: data,
|
||||
#queryParameters: queryParameters,
|
||||
#options: options,
|
||||
#cancelToken: cancelToken,
|
||||
#onSendProgress: onSendProgress,
|
||||
#onReceiveProgress: onReceiveProgress,
|
||||
},
|
||||
),
|
||||
returnValue: _i8.Future<_i6.Response<T>>.value(_FakeResponse_4<T>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#post,
|
||||
[path],
|
||||
{
|
||||
#data: data,
|
||||
#queryParameters: queryParameters,
|
||||
#options: options,
|
||||
#cancelToken: cancelToken,
|
||||
#onSendProgress: onSendProgress,
|
||||
#onReceiveProgress: onReceiveProgress,
|
||||
},
|
||||
),
|
||||
)),
|
||||
) as _i8.Future<_i6.Response<T>>);
|
||||
|
||||
@override
|
||||
_i8.Future<_i6.Response<T>> postUri<T>(
|
||||
Uri? uri, {
|
||||
Object? data,
|
||||
_i2.Options? options,
|
||||
_i9.CancelToken? cancelToken,
|
||||
_i2.ProgressCallback? onSendProgress,
|
||||
_i2.ProgressCallback? onReceiveProgress,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#postUri,
|
||||
[uri],
|
||||
{
|
||||
#data: data,
|
||||
#options: options,
|
||||
#cancelToken: cancelToken,
|
||||
#onSendProgress: onSendProgress,
|
||||
#onReceiveProgress: onReceiveProgress,
|
||||
},
|
||||
),
|
||||
returnValue: _i8.Future<_i6.Response<T>>.value(_FakeResponse_4<T>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#postUri,
|
||||
[uri],
|
||||
{
|
||||
#data: data,
|
||||
#options: options,
|
||||
#cancelToken: cancelToken,
|
||||
#onSendProgress: onSendProgress,
|
||||
#onReceiveProgress: onReceiveProgress,
|
||||
},
|
||||
),
|
||||
)),
|
||||
) as _i8.Future<_i6.Response<T>>);
|
||||
|
||||
@override
|
||||
_i8.Future<_i6.Response<T>> put<T>(
|
||||
String? path, {
|
||||
Object? data,
|
||||
Map<String, dynamic>? queryParameters,
|
||||
_i2.Options? options,
|
||||
_i9.CancelToken? cancelToken,
|
||||
_i2.ProgressCallback? onSendProgress,
|
||||
_i2.ProgressCallback? onReceiveProgress,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#put,
|
||||
[path],
|
||||
{
|
||||
#data: data,
|
||||
#queryParameters: queryParameters,
|
||||
#options: options,
|
||||
#cancelToken: cancelToken,
|
||||
#onSendProgress: onSendProgress,
|
||||
#onReceiveProgress: onReceiveProgress,
|
||||
},
|
||||
),
|
||||
returnValue: _i8.Future<_i6.Response<T>>.value(_FakeResponse_4<T>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#put,
|
||||
[path],
|
||||
{
|
||||
#data: data,
|
||||
#queryParameters: queryParameters,
|
||||
#options: options,
|
||||
#cancelToken: cancelToken,
|
||||
#onSendProgress: onSendProgress,
|
||||
#onReceiveProgress: onReceiveProgress,
|
||||
},
|
||||
),
|
||||
)),
|
||||
) as _i8.Future<_i6.Response<T>>);
|
||||
|
||||
@override
|
||||
_i8.Future<_i6.Response<T>> putUri<T>(
|
||||
Uri? uri, {
|
||||
Object? data,
|
||||
_i2.Options? options,
|
||||
_i9.CancelToken? cancelToken,
|
||||
_i2.ProgressCallback? onSendProgress,
|
||||
_i2.ProgressCallback? onReceiveProgress,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#putUri,
|
||||
[uri],
|
||||
{
|
||||
#data: data,
|
||||
#options: options,
|
||||
#cancelToken: cancelToken,
|
||||
#onSendProgress: onSendProgress,
|
||||
#onReceiveProgress: onReceiveProgress,
|
||||
},
|
||||
),
|
||||
returnValue: _i8.Future<_i6.Response<T>>.value(_FakeResponse_4<T>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#putUri,
|
||||
[uri],
|
||||
{
|
||||
#data: data,
|
||||
#options: options,
|
||||
#cancelToken: cancelToken,
|
||||
#onSendProgress: onSendProgress,
|
||||
#onReceiveProgress: onReceiveProgress,
|
||||
},
|
||||
),
|
||||
)),
|
||||
) as _i8.Future<_i6.Response<T>>);
|
||||
|
||||
@override
|
||||
_i8.Future<_i6.Response<T>> patch<T>(
|
||||
String? path, {
|
||||
Object? data,
|
||||
Map<String, dynamic>? queryParameters,
|
||||
_i2.Options? options,
|
||||
_i9.CancelToken? cancelToken,
|
||||
_i2.ProgressCallback? onSendProgress,
|
||||
_i2.ProgressCallback? onReceiveProgress,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#patch,
|
||||
[path],
|
||||
{
|
||||
#data: data,
|
||||
#queryParameters: queryParameters,
|
||||
#options: options,
|
||||
#cancelToken: cancelToken,
|
||||
#onSendProgress: onSendProgress,
|
||||
#onReceiveProgress: onReceiveProgress,
|
||||
},
|
||||
),
|
||||
returnValue: _i8.Future<_i6.Response<T>>.value(_FakeResponse_4<T>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#patch,
|
||||
[path],
|
||||
{
|
||||
#data: data,
|
||||
#queryParameters: queryParameters,
|
||||
#options: options,
|
||||
#cancelToken: cancelToken,
|
||||
#onSendProgress: onSendProgress,
|
||||
#onReceiveProgress: onReceiveProgress,
|
||||
},
|
||||
),
|
||||
)),
|
||||
) as _i8.Future<_i6.Response<T>>);
|
||||
|
||||
@override
|
||||
_i8.Future<_i6.Response<T>> patchUri<T>(
|
||||
Uri? uri, {
|
||||
Object? data,
|
||||
_i2.Options? options,
|
||||
_i9.CancelToken? cancelToken,
|
||||
_i2.ProgressCallback? onSendProgress,
|
||||
_i2.ProgressCallback? onReceiveProgress,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#patchUri,
|
||||
[uri],
|
||||
{
|
||||
#data: data,
|
||||
#options: options,
|
||||
#cancelToken: cancelToken,
|
||||
#onSendProgress: onSendProgress,
|
||||
#onReceiveProgress: onReceiveProgress,
|
||||
},
|
||||
),
|
||||
returnValue: _i8.Future<_i6.Response<T>>.value(_FakeResponse_4<T>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#patchUri,
|
||||
[uri],
|
||||
{
|
||||
#data: data,
|
||||
#options: options,
|
||||
#cancelToken: cancelToken,
|
||||
#onSendProgress: onSendProgress,
|
||||
#onReceiveProgress: onReceiveProgress,
|
||||
},
|
||||
),
|
||||
)),
|
||||
) as _i8.Future<_i6.Response<T>>);
|
||||
|
||||
@override
|
||||
_i8.Future<_i6.Response<T>> delete<T>(
|
||||
String? path, {
|
||||
Object? data,
|
||||
Map<String, dynamic>? queryParameters,
|
||||
_i2.Options? options,
|
||||
_i9.CancelToken? cancelToken,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#delete,
|
||||
[path],
|
||||
{
|
||||
#data: data,
|
||||
#queryParameters: queryParameters,
|
||||
#options: options,
|
||||
#cancelToken: cancelToken,
|
||||
},
|
||||
),
|
||||
returnValue: _i8.Future<_i6.Response<T>>.value(_FakeResponse_4<T>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#delete,
|
||||
[path],
|
||||
{
|
||||
#data: data,
|
||||
#queryParameters: queryParameters,
|
||||
#options: options,
|
||||
#cancelToken: cancelToken,
|
||||
},
|
||||
),
|
||||
)),
|
||||
) as _i8.Future<_i6.Response<T>>);
|
||||
|
||||
@override
|
||||
_i8.Future<_i6.Response<T>> deleteUri<T>(
|
||||
Uri? uri, {
|
||||
Object? data,
|
||||
_i2.Options? options,
|
||||
_i9.CancelToken? cancelToken,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#deleteUri,
|
||||
[uri],
|
||||
{
|
||||
#data: data,
|
||||
#options: options,
|
||||
#cancelToken: cancelToken,
|
||||
},
|
||||
),
|
||||
returnValue: _i8.Future<_i6.Response<T>>.value(_FakeResponse_4<T>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#deleteUri,
|
||||
[uri],
|
||||
{
|
||||
#data: data,
|
||||
#options: options,
|
||||
#cancelToken: cancelToken,
|
||||
},
|
||||
),
|
||||
)),
|
||||
) as _i8.Future<_i6.Response<T>>);
|
||||
|
||||
@override
|
||||
_i8.Future<_i6.Response<dynamic>> download(
|
||||
String? urlPath,
|
||||
dynamic savePath, {
|
||||
_i2.ProgressCallback? onReceiveProgress,
|
||||
Map<String, dynamic>? queryParameters,
|
||||
_i9.CancelToken? cancelToken,
|
||||
bool? deleteOnError = true,
|
||||
_i2.FileAccessMode? fileAccessMode = _i2.FileAccessMode.write,
|
||||
String? lengthHeader = 'content-length',
|
||||
Object? data,
|
||||
_i2.Options? options,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#download,
|
||||
[
|
||||
urlPath,
|
||||
savePath,
|
||||
],
|
||||
{
|
||||
#onReceiveProgress: onReceiveProgress,
|
||||
#queryParameters: queryParameters,
|
||||
#cancelToken: cancelToken,
|
||||
#deleteOnError: deleteOnError,
|
||||
#fileAccessMode: fileAccessMode,
|
||||
#lengthHeader: lengthHeader,
|
||||
#data: data,
|
||||
#options: options,
|
||||
},
|
||||
),
|
||||
returnValue:
|
||||
_i8.Future<_i6.Response<dynamic>>.value(_FakeResponse_4<dynamic>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#download,
|
||||
[
|
||||
urlPath,
|
||||
savePath,
|
||||
],
|
||||
{
|
||||
#onReceiveProgress: onReceiveProgress,
|
||||
#queryParameters: queryParameters,
|
||||
#cancelToken: cancelToken,
|
||||
#deleteOnError: deleteOnError,
|
||||
#fileAccessMode: fileAccessMode,
|
||||
#lengthHeader: lengthHeader,
|
||||
#data: data,
|
||||
#options: options,
|
||||
},
|
||||
),
|
||||
)),
|
||||
) as _i8.Future<_i6.Response<dynamic>>);
|
||||
|
||||
@override
|
||||
_i8.Future<_i6.Response<dynamic>> downloadUri(
|
||||
Uri? uri,
|
||||
dynamic savePath, {
|
||||
_i2.ProgressCallback? onReceiveProgress,
|
||||
_i9.CancelToken? cancelToken,
|
||||
bool? deleteOnError = true,
|
||||
_i2.FileAccessMode? fileAccessMode = _i2.FileAccessMode.write,
|
||||
String? lengthHeader = 'content-length',
|
||||
Object? data,
|
||||
_i2.Options? options,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#downloadUri,
|
||||
[
|
||||
uri,
|
||||
savePath,
|
||||
],
|
||||
{
|
||||
#onReceiveProgress: onReceiveProgress,
|
||||
#cancelToken: cancelToken,
|
||||
#deleteOnError: deleteOnError,
|
||||
#fileAccessMode: fileAccessMode,
|
||||
#lengthHeader: lengthHeader,
|
||||
#data: data,
|
||||
#options: options,
|
||||
},
|
||||
),
|
||||
returnValue:
|
||||
_i8.Future<_i6.Response<dynamic>>.value(_FakeResponse_4<dynamic>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#downloadUri,
|
||||
[
|
||||
uri,
|
||||
savePath,
|
||||
],
|
||||
{
|
||||
#onReceiveProgress: onReceiveProgress,
|
||||
#cancelToken: cancelToken,
|
||||
#deleteOnError: deleteOnError,
|
||||
#fileAccessMode: fileAccessMode,
|
||||
#lengthHeader: lengthHeader,
|
||||
#data: data,
|
||||
#options: options,
|
||||
},
|
||||
),
|
||||
)),
|
||||
) as _i8.Future<_i6.Response<dynamic>>);
|
||||
|
||||
@override
|
||||
_i8.Future<_i6.Response<T>> request<T>(
|
||||
String? url, {
|
||||
Object? data,
|
||||
Map<String, dynamic>? queryParameters,
|
||||
_i9.CancelToken? cancelToken,
|
||||
_i2.Options? options,
|
||||
_i2.ProgressCallback? onSendProgress,
|
||||
_i2.ProgressCallback? onReceiveProgress,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#request,
|
||||
[url],
|
||||
{
|
||||
#data: data,
|
||||
#queryParameters: queryParameters,
|
||||
#cancelToken: cancelToken,
|
||||
#options: options,
|
||||
#onSendProgress: onSendProgress,
|
||||
#onReceiveProgress: onReceiveProgress,
|
||||
},
|
||||
),
|
||||
returnValue: _i8.Future<_i6.Response<T>>.value(_FakeResponse_4<T>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#request,
|
||||
[url],
|
||||
{
|
||||
#data: data,
|
||||
#queryParameters: queryParameters,
|
||||
#cancelToken: cancelToken,
|
||||
#options: options,
|
||||
#onSendProgress: onSendProgress,
|
||||
#onReceiveProgress: onReceiveProgress,
|
||||
},
|
||||
),
|
||||
)),
|
||||
) as _i8.Future<_i6.Response<T>>);
|
||||
|
||||
@override
|
||||
_i8.Future<_i6.Response<T>> requestUri<T>(
|
||||
Uri? uri, {
|
||||
Object? data,
|
||||
_i9.CancelToken? cancelToken,
|
||||
_i2.Options? options,
|
||||
_i2.ProgressCallback? onSendProgress,
|
||||
_i2.ProgressCallback? onReceiveProgress,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#requestUri,
|
||||
[uri],
|
||||
{
|
||||
#data: data,
|
||||
#cancelToken: cancelToken,
|
||||
#options: options,
|
||||
#onSendProgress: onSendProgress,
|
||||
#onReceiveProgress: onReceiveProgress,
|
||||
},
|
||||
),
|
||||
returnValue: _i8.Future<_i6.Response<T>>.value(_FakeResponse_4<T>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#requestUri,
|
||||
[uri],
|
||||
{
|
||||
#data: data,
|
||||
#cancelToken: cancelToken,
|
||||
#options: options,
|
||||
#onSendProgress: onSendProgress,
|
||||
#onReceiveProgress: onReceiveProgress,
|
||||
},
|
||||
),
|
||||
)),
|
||||
) as _i8.Future<_i6.Response<T>>);
|
||||
|
||||
@override
|
||||
_i8.Future<_i6.Response<T>> fetch<T>(_i2.RequestOptions? requestOptions) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetch,
|
||||
[requestOptions],
|
||||
),
|
||||
returnValue: _i8.Future<_i6.Response<T>>.value(_FakeResponse_4<T>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#fetch,
|
||||
[requestOptions],
|
||||
),
|
||||
)),
|
||||
) as _i8.Future<_i6.Response<T>>);
|
||||
|
||||
@override
|
||||
_i7.Dio clone({
|
||||
_i2.BaseOptions? options,
|
||||
_i5.Interceptors? interceptors,
|
||||
_i3.HttpClientAdapter? httpClientAdapter,
|
||||
_i4.Transformer? transformer,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#clone,
|
||||
[],
|
||||
{
|
||||
#options: options,
|
||||
#interceptors: interceptors,
|
||||
#httpClientAdapter: httpClientAdapter,
|
||||
#transformer: transformer,
|
||||
},
|
||||
),
|
||||
returnValue: _FakeDio_5(
|
||||
this,
|
||||
Invocation.method(
|
||||
#clone,
|
||||
[],
|
||||
{
|
||||
#options: options,
|
||||
#interceptors: interceptors,
|
||||
#httpClientAdapter: httpClientAdapter,
|
||||
#transformer: transformer,
|
||||
},
|
||||
),
|
||||
),
|
||||
) as _i7.Dio);
|
||||
}
|
||||
Reference in New Issue
Block a user