1

我想做这样的事情:

stubRequest("GET", "http://localhost:8000/api/foo").andReturn(401)
stubRequest("GET", "http://localhost:8000/api/foo").andReturn(200)

let result = service.myServiceCall()

XCTAssertEqual(result, "My Result")

...所以/api/foo在我的测试中第一次调用得到 401 响应,第二次调用得到 200。这对 Nocilla 可行吗?

请注意,这两个调用都发生在内部myServiceCall(),因此我无法重置中间的 Nocilla 存根。

4

0 回答 0