-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
100 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
iOS/Layover/Layover/Network/Mock/MockData/ReportPlaybackVideo.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"customCode": "SUCCESS", | ||
"message": "성공", | ||
"statusCode": 200, | ||
"data": { | ||
"memberId": 221, | ||
"boardId": 5, | ||
"reportType": "청소년에게 유해한 내용이에요" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// MockReportWorker.swift | ||
// Layover | ||
// | ||
// Created by 황지웅 on 12/5/23. | ||
// Copyright © 2023 CodeBomber. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import OSLog | ||
|
||
final class MockReportWorker: ReportWorkerProtocol { | ||
|
||
// MARK: - Properties | ||
|
||
private let provider: ProviderType = Provider(session: .initMockSession(), authManager: StubAuthManager()) | ||
|
||
// MARK: - Methods | ||
|
||
func reportPlaybackVideo(boardId: Int, reportContent: String) async -> Bool { | ||
guard let mockFileLocation = Bundle.main.url(forResource: "ReportPlaybackVideo", withExtension: "json"), | ||
let mockData = try? Data(contentsOf: mockFileLocation) | ||
else { | ||
return false | ||
} | ||
|
||
MockURLProtocol.requestHandler = { request in | ||
let response = HTTPURLResponse(url: request.url!, | ||
statusCode: 200, | ||
httpVersion: nil, | ||
headerFields: nil) | ||
return (response, mockData, nil) | ||
} | ||
|
||
do { | ||
let bodyParameters = ReportDTO( | ||
memberId: nil, | ||
boardId: 1, | ||
reportType: "청소년에게 유해한 내용입니다.") | ||
let endPoint = EndPoint<Response<ReportDTO>>(path: "/report", | ||
method: .POST, | ||
bodyParameters: bodyParameters) | ||
let response = try await provider.request(with: endPoint) | ||
return true | ||
} catch { | ||
os_log(.error, log: .data, "%@", error.localizedDescription) | ||
return false | ||
} | ||
} | ||
} |