测试已测试 | ✓ |
Lang语言 | Obj-CObjective C |
许可证 | MIT |
发布最后发布 | 2015年6月 |
由Piet Brauer、Renzo Crisóstomo、Martin Kim Dung-Pham维护。
依赖项 | |
OHHTTPStubs | >= 0 |
Expecta | >= 0 |
XNGAPIClient | >= 0 |
XINGAPIClient 的客户端测试器。
- (void)setUp {
[super setUp];
self.testHelper = [[XNGTestHelper alloc] init];
[self.testHelper setup];
}
- (void)tearDown {
[super tearDown];
[self.testHelper tearDown];
}
- (void)testGetNetworkFeed {
[self.testHelper executeCall:^{
// make a call using the XNGAPIClient
[[XNGAPIClient sharedClient] getNetworkFeedUntil:nil
userFields:nil
success:nil
failure:nil];
} withExpectations:^(NSURLRequest *request, NSMutableDictionary *query, NSMutableDictionary *body) {
// called when the stubbed response comes in
// this is the place where you should test your host, path and HTTP method
expect(request.URL.host).to.equal(@"www.xing.com");
expect(request.URL.path).to.equal(@"/v1/users/me/network_feed");
expect(request.HTTPMethod).to.equal(@"GET");
// remove all OAuth parameters
[self.testHelper removeOAuthParametersInQueryDict:query];
// test and remove a key from the query
// TODO: export this in a helper method
expect([query valueForKey:@"until"]).to.equal(@"1");
[query removeObjectForKey:@"until"];
expect([query valueForKey:@"user_fields"]).to.equal(@"display_name");
[query removeObjectForKey:@"user_fields"];
// assure that the query is empty
expect([query allKeys]).to.haveCountOf(0);
// just the same as in the query
expect([body allKeys]).to.haveCountOf(0);
}];
}