feat: 使用旅拍相册批量删除接口
This commit is contained in:
@@ -104,6 +104,22 @@ final class TravelAlbumAPITests: XCTestCase {
|
||||
XCTAssertEqual(query?.first { $0.name == "material_id" }?.value, "6")
|
||||
}
|
||||
|
||||
func testBatchDeleteMaterialsBuildsPathAndBody() async throws {
|
||||
let session = MockURLSession(responses: [envelopeJSON("{}")])
|
||||
let api = TravelAlbumAPI(client: APIClient(environment: .testing, session: session))
|
||||
|
||||
try await api.batchDeleteMaterials(ids: [2031, 2032, 2033])
|
||||
|
||||
let request = try XCTUnwrap(session.requests.first)
|
||||
XCTAssertEqual(request.httpMethod, "POST")
|
||||
XCTAssertEqual(
|
||||
request.url?.path,
|
||||
"/api/yf-handset-app/photog/travel-album/batch-delete-material"
|
||||
)
|
||||
let body = try JSONSerialization.jsonObject(with: try XCTUnwrap(request.httpBody)) as? [String: Any]
|
||||
XCTAssertEqual(body?["ids"] as? [Int], [2031, 2032, 2033])
|
||||
}
|
||||
|
||||
func testUploadMaterialBuildsPathAndBody() async throws {
|
||||
let material = envelopeJSON(#"{"id":6,"user_equity_travel_id":3,"status":1,"order_number":"","user_id":9,"file_name":"A.JPG","file_type":1,"file_url":"https://cdn/a.jpg","file_size":1024,"cover_url":"","is_purchased":false,"created_at":"2026-07-08 10:00:00","updated_at":"2026-07-08 10:00:00"}"#)
|
||||
let session = MockURLSession(responses: [material])
|
||||
|
||||
Reference in New Issue
Block a user