Skip to content

Commit 2325cd2

Browse files
authored
set version of OHHTTP lib (#334)
1 parent 2885e7e commit 2325cd2

File tree

11 files changed

+253
-253
lines changed

11 files changed

+253
-253
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
language: objective-c
2-
osx_image: xcode10
2+
osx_image: xcode11.3
33

44
xcode_workspace: Example/Leanplum-SDK.xcworkspace
55
xcode_scheme: Leanplum-SDK-Example
6-
xcode_destination: platform=iOS Simulator,OS=12.0,name=iPhone X
6+
xcode_destination: platform=iOS Simulator,OS=12.4,name=iPhone X
77

88
cache: cocoapods
99
podfile: Example/Podfile

Example/Tests/Classes/ExceptionsTest.m

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525

2626
#import <XCTest/XCTest.h>
2727
#import <UIKit/UIKit.h>
28-
#import <OHHTTPStubs/OHHTTPStubs.h>
29-
#import <OHHTTPStubs/OHPathHelpers.h>
28+
#import <OHHTTPStubs/HTTPStubs.h>
29+
#import <OHHTTPStubs/HTTPStubsPathHelpers.h>
3030
#import "LeanplumHelper.h"
3131
#import "LeanplumRequest+Categories.h"
3232
#import "LPNetworkEngine+Category.h"
@@ -54,7 +54,7 @@ - (void)tearDown
5454
[super tearDown];
5555
// Clean up after every test.
5656
[LeanplumHelper clean_up];
57-
[OHHTTPStubs removeAllStubs];
57+
[HTTPStubs removeAllStubs];
5858

5959
}
6060

@@ -63,11 +63,11 @@ - (void) test_start_offline
6363
[Leanplum_Reachability online:NO];
6464
[LeanplumHelper setup_development_test];
6565

66-
[OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest * _Nonnull request) {
66+
[HTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest * _Nonnull request) {
6767
return [request.URL.host isEqualToString:API_HOST];
68-
} withStubResponse:^OHHTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
68+
} withStubResponse:^HTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
6969
NSString* response_file = OHPathForFile(@"simple_start_response.json", self.class);
70-
return [OHHTTPStubsResponse responseWithFileAtPath:response_file statusCode:200
70+
return [HTTPStubsResponse responseWithFileAtPath:response_file statusCode:200
7171
headers:@{@"Content-Type":@"application/json"}];
7272
}];
7373

@@ -86,12 +86,12 @@ - (void) test_start_offline
8686

8787
- (void) test_start_malformed_response
8888
{
89-
[OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest * _Nonnull request) {
89+
[HTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest * _Nonnull request) {
9090
return [request.URL.host isEqualToString:API_HOST];
91-
} withStubResponse:^OHHTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
91+
} withStubResponse:^HTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
9292
NSString* response_file = OHPathForFile(@"malformed_simple_start_response.json",
9393
self.class);
94-
return [OHHTTPStubsResponse responseWithFileAtPath:response_file statusCode:200
94+
return [HTTPStubsResponse responseWithFileAtPath:response_file statusCode:200
9595
headers:@{@"Content-Type":@"application/json"}];
9696
}];
9797

@@ -100,11 +100,11 @@ - (void) test_start_malformed_response
100100

101101
- (void) test_start_http_error_400
102102
{
103-
[OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest * _Nonnull request) {
103+
[HTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest * _Nonnull request) {
104104
return [request.URL.host isEqualToString:API_HOST];
105-
} withStubResponse:^OHHTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
105+
} withStubResponse:^HTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
106106
NSString *response_file = OHPathForFile(@"simple_start_response.json", self.class);
107-
return [OHHTTPStubsResponse responseWithFileAtPath:response_file statusCode:400
107+
return [HTTPStubsResponse responseWithFileAtPath:response_file statusCode:400
108108
headers:@{@"Content-Type":@"application/json"}];
109109
}];
110110

@@ -113,11 +113,11 @@ - (void) test_start_http_error_400
113113

114114
- (void) test_start_http_error_401
115115
{
116-
[OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest * _Nonnull request) {
116+
[HTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest * _Nonnull request) {
117117
return [request.URL.host isEqualToString:API_HOST];
118-
} withStubResponse:^OHHTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
118+
} withStubResponse:^HTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
119119
NSString *response_file = OHPathForFile(@"simple_start_response.json", self.class);
120-
return [OHHTTPStubsResponse responseWithFileAtPath:response_file statusCode:401
120+
return [HTTPStubsResponse responseWithFileAtPath:response_file statusCode:401
121121
headers:@{@"Content-Type":@"application/json"}];
122122
}];
123123

@@ -126,11 +126,11 @@ - (void) test_start_http_error_401
126126

127127
- (void) test_start_http_error_404
128128
{
129-
[OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest * _Nonnull request) {
129+
[HTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest * _Nonnull request) {
130130
return [request.URL.host isEqualToString:API_HOST];
131-
} withStubResponse:^OHHTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
131+
} withStubResponse:^HTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
132132
NSString *response_file = OHPathForFile(@"simple_start_response.json", self.class);
133-
return [OHHTTPStubsResponse responseWithFileAtPath:response_file statusCode:404
133+
return [HTTPStubsResponse responseWithFileAtPath:response_file statusCode:404
134134
headers:@{@"Content-Type":@"application/json"}];
135135
}];
136136

@@ -140,12 +140,12 @@ - (void) test_start_http_error_404
140140
- (void) test_failed_track
141141
{
142142
// This stub have to be removed when start command is successfully executed.
143-
id<OHHTTPStubsDescriptor> startStub = [OHHTTPStubs stubRequestsPassingTest:
143+
id<HTTPStubsDescriptor> startStub = [HTTPStubs stubRequestsPassingTest:
144144
^BOOL(NSURLRequest * _Nonnull request) {
145145
return [request.URL.host isEqualToString:API_HOST];
146-
} withStubResponse:^OHHTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
146+
} withStubResponse:^HTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
147147
NSString *response_file = OHPathForFile(@"simple_start_response.json", self.class);
148-
return [OHHTTPStubsResponse responseWithFileAtPath:response_file statusCode:200
148+
return [HTTPStubsResponse responseWithFileAtPath:response_file statusCode:200
149149
headers:@{@"Content-Type":@"application/json"}];
150150
}];
151151

@@ -154,15 +154,15 @@ - (void) test_failed_track
154154
}
155155

156156
// Remove stub after start is successful.
157-
[OHHTTPStubs removeStub:startStub];
157+
[HTTPStubs removeStub:startStub];
158158

159159
// Create a stub for track event response.
160-
[OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest * _Nonnull request) {
160+
[HTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest * _Nonnull request) {
161161
return [request.URL.host isEqualToString:API_HOST];
162-
} withStubResponse:^OHHTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
162+
} withStubResponse:^HTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
163163
NSString *response_file = OHPathForFile(@"malformed_track_event_response.json",
164164
self.class);
165-
return [OHHTTPStubsResponse responseWithFileAtPath:response_file statusCode:404
165+
return [HTTPStubsResponse responseWithFileAtPath:response_file statusCode:404
166166
headers:@{@"Content-Type":@"application/json"}];
167167
}];
168168

Example/Tests/Classes/LPActionManagerTest.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525

2626
#import <XCTest/XCTest.h>
2727
#import <OCMock/OCMock.h>
28-
#import <OHHTTPStubs/OHHTTPStubs.h>
29-
#import <OHHTTPStubs/OHPathHelpers.h>
28+
#import <OHHTTPStubs/HTTPStubs.h>
29+
#import <OHHTTPStubs/HTTPStubsPathHelpers.h>
3030
#import "LPActionManager.h"
3131
#import "LeanplumHelper.h"
3232
#import "LeanplumRequest+Categories.h"

Example/Tests/Classes/LPAppIconManagerTest.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424

2525

2626
#import <XCTest/XCTest.h>
27-
#import <OHHTTPStubs/OHHTTPStubs.h>
28-
#import <OHHTTPStubs/OHPathHelpers.h>
27+
#import <OHHTTPStubs/HTTPStubs.h>
28+
#import <OHHTTPStubs/HTTPStubsPathHelpers.h>
2929
#import "LPAppIconManager.h"
3030
#import "LeanplumHelper.h"
3131
#import "LPVarCache.h"
@@ -69,7 +69,7 @@ - (void)tearDown {
6969
[super tearDown];
7070
// Clean up after every test.
7171
[LeanplumHelper clean_up];
72-
[OHHTTPStubs removeAllStubs];
72+
[HTTPStubs removeAllStubs];
7373
}
7474

7575
- (void)test_supportsAlternateIcons {

Example/Tests/Classes/LPEventDataManagerTest.m

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424

2525

2626
#import <XCTest/XCTest.h>
27-
#import <OHHTTPStubs/OHHTTPStubs.h>
28-
#import <OHHTTPStubs/OHPathHelpers.h>
27+
#import <OHHTTPStubs/HTTPStubs.h>
28+
#import <OHHTTPStubs/HTTPStubsPathHelpers.h>
2929
#import "LeanplumHelper.h"
3030
#import "LPEventDataManager.h"
3131
#import "LPDatabase.h"
@@ -134,11 +134,11 @@ - (void)test_request_synchronous
134134
[Leanplum_Reachability online:YES];
135135

136136
// Simulate slow network.
137-
[OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest * _Nonnull request) {
137+
[HTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest * _Nonnull request) {
138138
return [request.URL.host isEqualToString:API_HOST];;
139-
} withStubResponse:^OHHTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
139+
} withStubResponse:^HTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
140140
NSString *response_file = OHPathForFile(@"action_response.json", self.class);
141-
return [[OHHTTPStubsResponse responseWithFileAtPath:response_file statusCode:200
141+
return [[HTTPStubsResponse responseWithFileAtPath:response_file statusCode:200
142142
headers:@{@"Content-Type":@"application/json"}]
143143
requestTime:1.0 responseTime:1.0];
144144
}];
@@ -167,7 +167,7 @@ - (void)test_request_synchronous
167167
// Clean up.
168168
[[LPOperationQueue serialQueue] cancelAllOperations];
169169
[[LPOperationQueue serialQueue] waitUntilAllOperationsAreFinished];
170-
[OHHTTPStubs removeAllStubs];
170+
[HTTPStubs removeAllStubs];
171171
}
172172

173173
- (void)test_response_code
@@ -179,11 +179,11 @@ - (void)test_response_code
179179
[Leanplum_Reachability online:YES];
180180

181181
// Simulate error from http response code.
182-
[OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) {
182+
[HTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) {
183183
return [request.URL.host isEqualToString:API_HOST];;
184-
} withStubResponse:^OHHTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
184+
} withStubResponse:^HTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
185185
NSData *data = [@"Fail" dataUsingEncoding:NSUTF8StringEncoding];
186-
return [OHHTTPStubsResponse responseWithData:data statusCode:500 headers:nil];
186+
return [HTTPStubsResponse responseWithData:data statusCode:500 headers:nil];
187187
}];
188188

189189
NSArray *events = [LPEventDataManager eventsWithLimit:10000];
@@ -195,7 +195,7 @@ - (void)test_response_code
195195
XCTAssertTrue(events.count == 1);
196196

197197
[LPEventDataManager deleteEventsWithLimit:10000];
198-
[OHHTTPStubs removeAllStubs];
198+
[HTTPStubs removeAllStubs];
199199
}
200200

201201
- (void)test_uuid
@@ -207,12 +207,12 @@ - (void)test_uuid
207207
[Leanplum_Reachability online:YES];
208208

209209
// Simulate Error.
210-
id<OHHTTPStubsDescriptor> stubs = [OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) {
210+
id<HTTPStubsDescriptor> stubs = [HTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) {
211211
return [request.URL.host isEqualToString:API_HOST];;
212-
} withStubResponse:^OHHTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
212+
} withStubResponse:^HTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
213213
NSError *error = [NSError errorWithDomain:NSURLErrorDomain
214214
code:NSURLErrorBadServerResponse userInfo:nil];
215-
return [OHHTTPStubsResponse responseWithError:error];
215+
return [HTTPStubsResponse responseWithError:error];
216216
}];
217217

218218
// UUID should be the same.
@@ -241,12 +241,12 @@ - (void)test_uuid
241241
XCTAssertFalse([events[0][@"uuid"] isEqual:events[3][@"uuid"]]);
242242

243243
// Delete events on success.
244-
[OHHTTPStubs removeStub:stubs];
245-
[OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest * _Nonnull request) {
244+
[HTTPStubs removeStub:stubs];
245+
[HTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest * _Nonnull request) {
246246
return [request.URL.host isEqualToString:API_HOST];;
247-
} withStubResponse:^OHHTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
247+
} withStubResponse:^HTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
248248
NSData *responseData = [@"Success" dataUsingEncoding:NSUTF8StringEncoding];
249-
return [OHHTTPStubsResponse responseWithData:responseData statusCode:200
249+
return [HTTPStubsResponse responseWithData:responseData statusCode:200
250250
headers:@{@"Content-Type":@"application/json"}];
251251
}];
252252

@@ -291,11 +291,11 @@ - (void)test_response_index
291291
[Leanplum_Reachability online:YES];
292292
[NSThread sleepForTimeInterval:0.1];
293293

294-
[OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) {
294+
[HTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) {
295295
return [request.URL.host isEqualToString:API_HOST];
296-
} withStubResponse:^OHHTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
296+
} withStubResponse:^HTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
297297
NSString *response_file = OHPathForFile(@"batch_response.json", self.class);
298-
return [OHHTTPStubsResponse responseWithFileAtPath:response_file statusCode:200
298+
return [HTTPStubsResponse responseWithFileAtPath:response_file statusCode:200
299299
headers:@{@"Content-Type":@"application/json"}];
300300
}];
301301

Example/Tests/Classes/LPFileManagerTest.m

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424

2525

2626
#import <XCTest/XCTest.h>
27-
#import <OHHTTPStubs/OHHTTPStubs.h>
28-
#import <OHHTTPStubs/OHPathHelpers.h>
27+
#import <OHHTTPStubs/HTTPStubs.h>
28+
#import <OHHTTPStubs/HTTPStubsPathHelpers.h>
2929
#import "LPFileManager.h"
3030
#import "LeanplumHelper.h"
3131
#import "LeanplumRequest+Categories.h"
@@ -53,7 +53,7 @@ - (void)tearDown {
5353
[super tearDown];
5454
// Clean up after every test.
5555
[LeanplumHelper clean_up];
56-
[OHHTTPStubs removeAllStubs];
56+
[HTTPStubs removeAllStubs];
5757
}
5858

5959
/**
@@ -145,26 +145,26 @@ - (void)test_file_download
145145
[[NSFileManager defaultManager] removeItemAtPath:path error:&error];
146146
}
147147

148-
id<OHHTTPStubsDescriptor> startStub = [OHHTTPStubs stubRequestsPassingTest:
148+
id<HTTPStubsDescriptor> startStub = [HTTPStubs stubRequestsPassingTest:
149149
^BOOL(NSURLRequest * _Nonnull request) {
150150
return [request.URL.host isEqualToString:API_HOST];
151-
} withStubResponse:^OHHTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
151+
} withStubResponse:^HTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
152152
NSString *response_file = OHPathForFile(@"simple_start_response.json", self.class);
153-
return [OHHTTPStubsResponse responseWithFileAtPath:response_file statusCode:200
153+
return [HTTPStubsResponse responseWithFileAtPath:response_file statusCode:200
154154
headers:@{@"Content-Type":@"application/json"}];
155155
}];
156156

157157
XCTAssertTrue([LeanplumHelper start_development_test]);
158158

159159
// Remove stub after start is successful.
160-
[OHHTTPStubs removeStub:startStub];
160+
[HTTPStubs removeStub:startStub];
161161

162162
// Mock file download, return real file from file system.
163-
[OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest * _Nonnull request) {
163+
[HTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest * _Nonnull request) {
164164
return [request.URL.host isEqualToString:API_HOST];
165-
} withStubResponse:^OHHTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
165+
} withStubResponse:^HTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
166166
NSData *data = [LeanplumHelper retrieve_data_from_file:@"test" ofType:@"pdf"];
167-
return [OHHTTPStubsResponse responseWithData:data statusCode:200 headers:nil];
167+
return [HTTPStubsResponse responseWithData:data statusCode:200 headers:nil];
168168
}];
169169

170170
// Validate request.
@@ -193,12 +193,12 @@ - (void)test_file_download
193193

194194
- (void)test_file_upload
195195
{
196-
[OHHTTPStubs stubRequestsPassingTest:
196+
[HTTPStubs stubRequestsPassingTest:
197197
^BOOL(NSURLRequest * _Nonnull request) {
198198
return [request.URL.host isEqualToString:API_HOST];
199-
} withStubResponse:^OHHTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
199+
} withStubResponse:^HTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
200200
NSString *response_file = OHPathForFile(@"simple_start_response.json", self.class);
201-
return [OHHTTPStubsResponse responseWithFileAtPath:response_file statusCode:200
201+
return [HTTPStubsResponse responseWithFileAtPath:response_file statusCode:200
202202
headers:@{@"Content-Type":@"application/json"}];
203203
}];
204204

0 commit comments

Comments
 (0)