AutoCat2/AutoCatCore/Testing/Api/Mocks/GenericMethodMock.swift

23 lines
580 B
Swift

//
// GenericMethodMock.swift
// AutoCatCore
//
// Created by Selim Mustafaev on 06.04.2022.
//
import Foundation
class GenericMethodMock: ApiMethodMock {
private var responsFileName: String
init(httpMethod: String, path: String, responsFileName: String) {
self.responsFileName = responsFileName
super.init(httpMethod: httpMethod, path: path)
}
override func response(headers: [String : String], params: [String : Any]) -> (status: Int, data: Data?) {
return (status: 200, data: readData(from: responsFileName))
}
}