diff options
author | Julian Rex <julian.rex@mapbox.com> | 2019-09-16 21:30:54 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-16 21:30:54 -0400 |
commit | a99240a54ffd5eb77568d41e10186411b1b759eb (patch) | |
tree | 63f86167e01a0249af63bee179b9b74ffc1cb99a /platform | |
parent | 8331b7adfe58d27b865b41bcf926a1b65a4022d9 (diff) | |
download | qtlocation-mapboxgl-a99240a54ffd5eb77568d41e10186411b1b759eb.tar.gz |
[ios] Add support for running tests (that require an access token) individually. (#15629)
Diffstat (limited to 'platform')
-rw-r--r-- | platform/ios/Integration Tests/MGLMapViewIntegrationTest.h | 1 | ||||
-rw-r--r-- | platform/ios/Integration Tests/MGLMapViewIntegrationTest.m | 17 |
2 files changed, 12 insertions, 6 deletions
diff --git a/platform/ios/Integration Tests/MGLMapViewIntegrationTest.h b/platform/ios/Integration Tests/MGLMapViewIntegrationTest.h index dd1b3bc949..08576e884a 100644 --- a/platform/ios/Integration Tests/MGLMapViewIntegrationTest.h +++ b/platform/ios/Integration Tests/MGLMapViewIntegrationTest.h @@ -25,7 +25,6 @@ }) @interface MGLMapViewIntegrationTest : XCTestCase <MGLMapViewDelegate> -@property (nonatomic) NSString *accessToken; @property (nonatomic) MGLMapView *mapView; @property (nonatomic) UIWindow *window; @property (nonatomic) MGLStyle *style; diff --git a/platform/ios/Integration Tests/MGLMapViewIntegrationTest.m b/platform/ios/Integration Tests/MGLMapViewIntegrationTest.m index 33b8e414cb..4095b4620b 100644 --- a/platform/ios/Integration Tests/MGLMapViewIntegrationTest.m +++ b/platform/ios/Integration Tests/MGLMapViewIntegrationTest.m @@ -31,10 +31,7 @@ // Check for tests that require a valid access token if ([test.name containsString:@"🔒"]) { - if (accessToken) { - ((MGLMapViewIntegrationTest *)test).accessToken = accessToken; - } - else { + if (!accessToken) { printf("warning: MAPBOX_ACCESS_TOKEN env var is required for test '%s' - skipping.\n", test.name.UTF8String); continue; } @@ -53,7 +50,17 @@ - (void)setUp { [super setUp]; - [MGLAccountManager setAccessToken:self.accessToken ?: @"pk.feedcafedeadbeefbadebede"]; + NSString *accessToken; + + if ([self.name containsString:@"🔒"]) { + accessToken = [[NSProcessInfo processInfo] environment][@"MAPBOX_ACCESS_TOKEN"]; + + if (!accessToken) { + printf("warning: MAPBOX_ACCESS_TOKEN env var is required for test '%s' - trying anyway.\n", self.name.UTF8String); + } + } + + [MGLAccountManager setAccessToken:accessToken ?: @"pk.feedcafedeadbeefbadebede"]; NSURL *styleURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"one-liner" withExtension:@"json"]; |