@@ -45,8 +45,9 @@ + (void)setUp
4545}
4646
4747- (void )setUp {
48+ [Leanplum setApiHostName: API_HOST withPath: API_PATH usingSsl: YES ];
49+ [Leanplum setSocketHostName: @" dev.leanplum.com" withPortNumber: 443 ];
4850 [LeanplumHelper setup_development_test ];
49- [[LPConstantsState sharedState ] setIsDevelopmentModeEnabled: YES ];
5051 [Leanplum setAppId: @" test" withDevelopmentKey: @" test" ];
5152}
5253
@@ -172,7 +173,10 @@ - (void)testSendNowWithDatas {
172173}
173174
174175- (void )testSendRequestsUpdateHost {
175- id changeHostStub = [HTTPStubs stubRequestsPassingTest: ^BOOL (NSURLRequest * _Nonnull request) {
176+ // use production, socket is not needed
177+ [Leanplum setAppId: @" test" withProductionKey: @" test" ];
178+
179+ __block __weak id changeHostStub = [HTTPStubs stubRequestsPassingTest: ^BOOL (NSURLRequest * _Nonnull request) {
176180 return [request.URL.host isEqualToString: API_HOST];
177181 } withStubResponse: ^HTTPStubsResponse * _Nonnull (NSURLRequest * _Nonnull request) {
178182 [HTTPStubs removeStub: changeHostStub];
@@ -206,15 +210,15 @@ - (void)testSendRequestsUpdateHost {
206210}
207211
208212- (void )testUpdateSocketHost {
209- id changeSocketStub = [HTTPStubs stubRequestsPassingTest: ^BOOL (NSURLRequest * _Nonnull request) {
213+ [HTTPStubs stubRequestsPassingTest: ^BOOL (NSURLRequest * _Nonnull request) {
210214 return [request.URL.absoluteString hasPrefix: @" https://dev.leanplum.com:443/socket.io/1/?t=" ];
211215 } withStubResponse: ^HTTPStubsResponse * _Nonnull (NSURLRequest * _Nonnull request) {
212216 NSString *success = @" abcD12Efj3d64oMN18cX-:60:60:websocket,xhr-polling,jsonp-polling" ;
213217 NSData *data = [success dataUsingEncoding: NSUTF8StringEncoding];
214218 return [HTTPStubsResponse responseWithData: data statusCode: 200 headers: @{@" Content-Type" :@" text/plain" }];
215219 }];
216220
217- id changeHostStub = [HTTPStubs stubRequestsPassingTest: ^BOOL (NSURLRequest * _Nonnull request) {
221+ [HTTPStubs stubRequestsPassingTest: ^BOOL (NSURLRequest * _Nonnull request) {
218222 return [request.URL.host isEqualToString: API_HOST];
219223 } withStubResponse: ^HTTPStubsResponse * _Nonnull (NSURLRequest * _Nonnull request) {
220224 NSString *response_file = OHPathForFile (@" change_host_response.json" , self.class );
0 commit comments