为旅拍 OTG 上传增加 client_photo_id,并按服务端已登记 ID 同步本地上传状态。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -82,7 +82,8 @@ final class TravelAlbumAPITests: XCTestCase {
|
||||
TravelAlbumUploadMaterialRequest(
|
||||
userEquityTravelId: 3,
|
||||
fileName: "A.JPG",
|
||||
fileUrl: "https://cdn/a.jpg"
|
||||
fileUrl: "https://cdn/a.jpg",
|
||||
clientPhotoId: "2a1d96b1-c0cc-489f-9f42-419ff1439a62"
|
||||
)
|
||||
)
|
||||
|
||||
@ -94,6 +95,22 @@ final class TravelAlbumAPITests: XCTestCase {
|
||||
XCTAssertEqual(body?["user_equity_travel_id"] as? Int, 3)
|
||||
XCTAssertEqual(body?["file_name"] as? String, "A.JPG")
|
||||
XCTAssertEqual(body?["file_url"] as? String, "https://cdn/a.jpg")
|
||||
XCTAssertEqual(body?["client_photo_id"] as? String, "2a1d96b1-c0cc-489f-9f42-419ff1439a62")
|
||||
}
|
||||
|
||||
func testMaterialClientPhotoIdsBuildsPathQueryAndDecodesResponse() async throws {
|
||||
let data = envelopeJSON(#"{"client_photo_ids":["one","two"]}"#)
|
||||
let session = MockURLSession(responses: [data])
|
||||
let api = TravelAlbumAPI(client: APIClient(environment: .testing, session: session))
|
||||
|
||||
let response = try await api.materialClientPhotoIds(userEquityTravelId: 3)
|
||||
|
||||
XCTAssertEqual(response.clientPhotoIds, ["one", "two"])
|
||||
let request = try XCTUnwrap(session.requests.first)
|
||||
XCTAssertEqual(request.httpMethod, "GET")
|
||||
XCTAssertEqual(request.url?.path, "/api/yf-handset-app/photog/travel-album/material-client-photo-ids")
|
||||
let query = URLComponents(url: request.url!, resolvingAgainstBaseURL: false)?.queryItems
|
||||
XCTAssertEqual(query?.first { $0.name == "user_equity_travel_id" }?.value, "3")
|
||||
}
|
||||
|
||||
private func envelopeJSON(_ dataJSON: String) -> Data {
|
||||
|
||||
Reference in New Issue
Block a user