XNGAPIClientTester 0.2.0

XNGAPIClientTester 0.2.0

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布最后发布2015年6月

Piet BrauerRenzo CrisóstomoMartin Kim Dung-Pham维护。



 
依赖项
OHHTTPStubs>= 0
Expecta>= 0
XNGAPIClient>= 0
 

  • 作者
  • XING iOS 团队

Dependency Status

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);
     }];
}