diff --git a/TestObjectiveDropbox/IntegrationTests/TestAppType.h b/TestObjectiveDropbox/IntegrationTests/TestAppType.h index f6e1988a2..40f97483f 100644 --- a/TestObjectiveDropbox/IntegrationTests/TestAppType.h +++ b/TestObjectiveDropbox/IntegrationTests/TestAppType.h @@ -9,10 +9,9 @@ #import typedef NS_ENUM(NSInteger, ApiAppPermissionType) { - FullDropbox, - TeamMemberFileAccess, - TeamMemberManagement, + FullDropboxScoped, + FullDropboxScopedForTeamTesting, }; /// Toggle this variable depending on which set of tests you are running. -static ApiAppPermissionType appPermission = (ApiAppPermissionType)FullDropbox; +static ApiAppPermissionType appPermission = (ApiAppPermissionType)FullDropboxScoped; diff --git a/TestObjectiveDropbox/IntegrationTests/TestClasses.h b/TestObjectiveDropbox/IntegrationTests/TestClasses.h index 18f3d3366..3ab97fbb0 100644 --- a/TestObjectiveDropbox/IntegrationTests/TestClasses.h +++ b/TestObjectiveDropbox/IntegrationTests/TestClasses.h @@ -14,6 +14,7 @@ @class TeamTests; @interface DropboxTester : NSObject ++ (NSArray*_Nonnull)scopesForTests; - (nonnull instancetype)initWithUserClient:(DBUserClient *_Nonnull)userClient testData:(TestData *_Nonnull)testData; - (nonnull instancetype)initWithTestData:(TestData * _Nonnull)testData; @@ -29,7 +30,7 @@ @end @interface DropboxTeamTester : NSObject - ++ (NSArray*_Nonnull)scopesForTests; - (nonnull instancetype)initWithTeamClient:(DBTeamClient *_Nonnull)teamClient testData:(TestData * _Nonnull)testData; - (nonnull instancetype)initWithTestData:(TestData * _Nonnull)testData; diff --git a/TestObjectiveDropbox/IntegrationTests/TestClasses.m b/TestObjectiveDropbox/IntegrationTests/TestClasses.m index 8c509947c..bf8f2f06f 100644 --- a/TestObjectiveDropbox/IntegrationTests/TestClasses.m +++ b/TestObjectiveDropbox/IntegrationTests/TestClasses.m @@ -19,6 +19,10 @@ void MyLog(NSString *format, ...) { } @implementation DropboxTester ++ (NSArray*)scopesForTests { + return [@"account_info.read files.content.read files.content.write files.metadata.read files.metadata.write sharing.write sharing.read" componentsSeparatedByString:@" "]; +} + - (instancetype)initWithUserClient:(DBUserClient *)userClient testData:(TestData *)testData { self = [super init]; if (self) { @@ -228,6 +232,14 @@ - (void)testUsersEndpoints:(void (^)(void))nextTest { @end @implementation DropboxTeamTester ++ (NSArray*)scopesForTests { + NSString *scopesForTeamRoutesTests = @"groups.read groups.write members.delete members.read members.write sessions.list team_data.member team_info.read"; + NSString *scopesForMemberFileAccessUserTests = @"files.content.write files.content.read sharing.write account_info.read"; + return [[NSString stringWithFormat:@"%@ %@", + scopesForTeamRoutesTests, + scopesForMemberFileAccessUserTests] componentsSeparatedByString:@" "]; +} + - (instancetype)initWithTeamClient:(DBTeamClient *)teamClient testData:(TestData * _Nonnull)testData { self = [super init]; if (self) { diff --git a/TestObjectiveDropbox/IntegrationTests/TestData.h b/TestObjectiveDropbox/IntegrationTests/TestData.h index e0dc29337..7f6654735 100644 --- a/TestObjectiveDropbox/IntegrationTests/TestData.h +++ b/TestObjectiveDropbox/IntegrationTests/TestData.h @@ -62,10 +62,4 @@ @property(nonatomic, copy) NSString * _Nonnull fullDropboxAppKey; @property(nonatomic, copy) NSString * _Nonnull fullDropboxAppSecret; -@property(nonatomic, copy) NSString * _Nonnull teamMemberFileAccessAppKey; -@property(nonatomic, copy) NSString * _Nonnull teamMemberFileAccessAppSecret; - -@property(nonatomic, copy) NSString * _Nonnull teamMemberManagementAppKey; -@property(nonatomic, copy) NSString * _Nonnull teamMemberManagementAppSecret; - @end diff --git a/TestObjectiveDropbox/IntegrationTests/TestData.m b/TestObjectiveDropbox/IntegrationTests/TestData.m index dfbf63eaa..98bc1cd24 100644 --- a/TestObjectiveDropbox/IntegrationTests/TestData.m +++ b/TestObjectiveDropbox/IntegrationTests/TestData.m @@ -50,12 +50,6 @@ - (instancetype)init { // App key and secret _fullDropboxAppKey = @""; _fullDropboxAppSecret = @""; - - _teamMemberFileAccessAppKey = @""; - _teamMemberFileAccessAppSecret = @""; - - _teamMemberManagementAppKey = @""; - _teamMemberManagementAppSecret = @""; } return self; } diff --git a/TestObjectiveDropbox/TestObjectiveDropbox_iOS/AppDelegate.m b/TestObjectiveDropbox/TestObjectiveDropbox_iOS/AppDelegate.m index bec7baf39..d0d9f200a 100644 --- a/TestObjectiveDropbox/TestObjectiveDropbox_iOS/AppDelegate.m +++ b/TestObjectiveDropbox/TestObjectiveDropbox_iOS/AppDelegate.m @@ -27,9 +27,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( TestData *data = [TestData new]; - if ([data.fullDropboxAppSecret containsString:@"<"] || - [data.teamMemberFileAccessAppKey containsString:@"<"] || - [data.teamMemberManagementAppKey containsString:@"<"]) { + if ([data.fullDropboxAppSecret containsString:@"<"]) { NSLog(@"\n\n\nMust set test data (in TestData.h) before launching app.\n\n\nTerminating.....\n\n"); exit(0); } @@ -51,10 +49,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( delegateQueue:[NSOperationQueue new] forceForegroundSession:NO sharedContainerIdentifier:[NSBundle mainBundle].bundleIdentifier]; - DBTransportDefaultConfig *transportConfigTeamFileAccess = - [[DBTransportDefaultConfig alloc] initWithAppKey:data.teamMemberFileAccessAppKey appSecret:data.teamMemberFileAccessAppSecret]; - DBTransportDefaultConfig *transportConfigTeamManagement = - [[DBTransportDefaultConfig alloc] initWithAppKey:data.teamMemberManagementAppKey appSecret:data.teamMemberManagementAppSecret]; void (^networkGlobalResponseBlock)(DBRequestError *, DBTask *) = ^(DBRequestError *networkError, DBTask *restartTask) { @@ -70,14 +64,11 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( [DBGlobalErrorResponseHandler registerNetworkErrorResponseBlock:networkGlobalResponseBlock]; switch (appPermission) { - case FullDropbox: + case FullDropboxScoped: [DBClientsManager setupWithTransportConfig:transportConfigFullDropbox]; break; - case TeamMemberFileAccess: - [DBClientsManager setupWithTeamTransportConfig:transportConfigTeamFileAccess]; - break; - case TeamMemberManagement: - [DBClientsManager setupWithTeamTransportConfig:transportConfigTeamManagement]; + case FullDropboxScopedForTeamTesting: + [DBClientsManager setupWithTeamTransportConfig:transportConfigFullDropbox]; break; } @@ -162,12 +153,11 @@ - (BOOL)db_handleAuthUrl:(NSURL *)url { BOOL handled = NO; switch (appPermission) { - case FullDropbox: { + case FullDropboxScoped: { handled = [DBClientsManager handleRedirectURL:url completion:completion]; break; } - case TeamMemberFileAccess: - case TeamMemberManagement: + case FullDropboxScopedForTeamTesting: handled = [DBClientsManager handleRedirectURLTeam:url completion:completion]; break; } diff --git a/TestObjectiveDropbox/TestObjectiveDropbox_iOS/Base.lproj/Main.storyboard b/TestObjectiveDropbox/TestObjectiveDropbox_iOS/Base.lproj/Main.storyboard index e9ca4be60..2da16de78 100644 --- a/TestObjectiveDropbox/TestObjectiveDropbox_iOS/Base.lproj/Main.storyboard +++ b/TestObjectiveDropbox/TestObjectiveDropbox_iOS/Base.lproj/Main.storyboard @@ -1,9 +1,9 @@ - + - + @@ -19,50 +19,43 @@ - - - - - - - -