Skip to content

Commit

Permalink
Merged PR #1289 into dependabot-test-09-11-2023-09-03
Browse files Browse the repository at this point in the history
  • Loading branch information
Dependabot Merger Bot committed Sep 11, 2023
2 parents 8927069 + 299de04 commit 9ded4a2
Show file tree
Hide file tree
Showing 33 changed files with 859 additions and 138 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/automation-trigger-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
BROWSERSTACK_USER: ${{ secrets.BROWSER_STACK_USER }}
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install the Apple certificate and provisioning profile
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
echo "::add-mask::$parsed"
echo "APP_URL=$parsed" >> "$GITHUB_ENV"
- name: Cheout Automation Code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: BranchMetrics/qentelli-saas-sdk-testing-automation
token: ${{ secrets.BRANCHLET_ACCESS_TOKEN_PUBLIC }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependabot-merger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: master

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Ruby 2.7
uses: ruby/setup-ruby@v1
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/post-release-qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install pod, build project and run tests
run: |
./scripts/getSimulator
Expand All @@ -20,7 +20,7 @@ jobs:
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Run carthage command, build project and run tests
run: |
./scripts/getSimulator
Expand All @@ -32,7 +32,7 @@ jobs:
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: build project and run tests
run: |
./scripts/getSimulator
Expand All @@ -43,7 +43,7 @@ jobs:
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install pod, build project and run tests
run: |
./scripts/getSimulator
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/pre-release-qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install pod, build project and run tests
run: |
./scripts/getSimulator
Expand All @@ -19,7 +19,7 @@ jobs:
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Create Cart File, run carthage command, build project and run tests
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
Expand All @@ -35,7 +35,7 @@ jobs:
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: build project and run tests
run: |
./scripts/getSimulator
Expand All @@ -46,7 +46,7 @@ jobs:
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: build xcframework, then build project and run tests
run: |
./scripts/getSimulator
Expand All @@ -58,7 +58,7 @@ jobs:
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: build static xcframework, then build project and run tests
run: |
./scripts/getSimulator
Expand All @@ -70,7 +70,7 @@ jobs:
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install pod, build project and run tests
run: |
./scripts/getSimulator
Expand All @@ -82,7 +82,7 @@ jobs:
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Verify Integration using Carthage for tvOS
run: |
./scripts/getSimulator
Expand All @@ -93,7 +93,7 @@ jobs:
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: build xcframework, then build project and run tests
run: |
./scripts/getSimulator
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Run static analysis
run: |
xcodebuild analyze -project BranchSDK.xcodeproj
Expand All @@ -31,7 +31,7 @@ jobs:
# needs: [static-analysis]
# steps:
# - name: Check out code
# uses: actions/checkout@v3
# uses: actions/checkout@v4
# - name: Update Version
# run: |
# if [[ ${{ inputs.version }} == "patch" ]]; then
Expand All @@ -56,7 +56,7 @@ jobs:
needs: [static-analysis]
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Build xcframework
run: |
./scripts/prep_xcframework.sh
Expand All @@ -74,7 +74,7 @@ jobs:
needs: [static-analysis]
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Build xcframework
run: |
./scripts/prep_xcframework_noidfa.sh
Expand All @@ -92,7 +92,7 @@ jobs:
needs: [static-analysis]
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Build static xcframework
run: |
./scripts/prep_static_xcframework.sh
Expand All @@ -110,7 +110,7 @@ jobs:
needs: [static-analysis]
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Build static xcframework
run: |
./scripts/prep_static_xcframework_noidfa.sh
Expand All @@ -127,7 +127,7 @@ jobs:
needs: [build-framework, build-static-framework, build-noidfa-framework, build-static-noidfa-framework]
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Ruby 2.7
uses: ruby/setup-ruby@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Ruby 2.7
uses: ruby/setup-ruby@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/version-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Ruby 2.7
uses: ruby/setup-ruby@v1
with:
Expand Down
30 changes: 30 additions & 0 deletions Branch-TestBed/Branch-SDK-Tests/BNCServerRequestQueueTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#import "BranchInstallRequest.h"
#import "BranchOpenRequest.h"
#import "BranchEvent.h"
#import "BranchSetIdentityRequest.h"
#import "BranchLogoutRequest.h"

@interface BNCServerRequestQueue ()
- (NSData *)archiveQueue:(NSArray<BNCServerRequest *> *)queue;
Expand Down Expand Up @@ -102,6 +104,32 @@ - (void)testArchiveEventRequest {
// The request object is not very test friendly, so comparing the two is not helpful at the moment
}

- (void)testArchiveSetIdentityRequest {
BranchSetIdentityRequest *object = [BranchSetIdentityRequest new];

NSData *archived = [self.queue archiveObject:object];
XCTAssertNotNil(archived);

BranchSetIdentityRequest *unarchived = [self.queue unarchiveObjectFromData:archived];
XCTAssertNotNil(unarchived);
XCTAssert([unarchived isKindOfClass:[BranchSetIdentityRequest class]]);

// The request object is not very test friendly, so comparing the two is not helpful at the moment
}

- (void)testArchiveLogoutRequest {
BranchLogoutRequest *object = [BranchLogoutRequest new];

NSData *archived = [self.queue archiveObject:object];
XCTAssertNotNil(archived);

BranchLogoutRequest *unarchived = [self.queue unarchiveObjectFromData:archived];
XCTAssertNotNil(unarchived);
XCTAssert([unarchived isKindOfClass:[BranchLogoutRequest class]]);

// The request object is not very test friendly, so comparing the two is not helpful at the moment
}

- (void)testArchiveArrayOfRequests {
NSMutableArray<BNCServerRequest *> *tmp = [NSMutableArray<BNCServerRequest *> new];
[tmp addObject:[BranchOpenRequest new]];
Expand Down Expand Up @@ -133,6 +161,7 @@ - (void)testArchiveArrayOfInvalidObjects {
[tmp addObject:[BranchOpenRequest new]];
[tmp addObject:@"Hello World"];
[tmp addObject:[BranchEventRequest new]];
[tmp addObject:[BranchCloseRequest new]];

NSData *data = [self.queue archiveQueue:tmp];
XCTAssertNotNil(data);
Expand All @@ -148,6 +177,7 @@ - (void)testOldArchiveArrayOfInvalidObjects {
[tmp addObject:[BranchOpenRequest new]];
[tmp addObject:@"Hello World"];
[tmp addObject:[BranchEventRequest new]];
[tmp addObject:[BranchCloseRequest new]];

NSData *data = [self.queue oldArchiveQueue:tmp];
XCTAssertNotNil(data);
Expand Down
105 changes: 105 additions & 0 deletions Branch-TestBed/Branch-SDK-Tests/BranchLogoutRequestTests.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
//
// BranchLogoutRequestTests.m
// Branch-TestBed
//
// Created by Graham Mueller on 6/10/15.
// Copyright (c) 2015 Branch Metrics. All rights reserved.
//

#import "BNCTestCase.h"
#import "BranchLogoutRequest.h"
#import "BranchConstants.h"
#import "BNCPreferenceHelper.h"
#import <OCMock/OCMock.h>

@interface BranchLogoutRequestTests : BNCTestCase
@end

@implementation BranchLogoutRequestTests

- (void)testRequestBody {
BNCPreferenceHelper *preferenceHelper = [BNCPreferenceHelper sharedInstance];
NSDictionary * const expectedParams = @{
BRANCH_REQUEST_KEY_RANDOMIZED_BUNDLE_TOKEN: preferenceHelper.randomizedBundleToken,
BRANCH_REQUEST_KEY_RANDOMIZED_DEVICE_TOKEN: preferenceHelper.randomizedDeviceToken,
BRANCH_REQUEST_KEY_SESSION_ID: preferenceHelper.sessionID
};

BranchLogoutRequest *request = [[BranchLogoutRequest alloc] init];
id serverInterfaceMock = OCMClassMock([BNCServerInterface class]);
[[serverInterfaceMock expect] postRequest:expectedParams url:[self stringMatchingPattern:BRANCH_REQUEST_ENDPOINT_LOGOUT] key:[OCMArg any] callback:[OCMArg any]];

[request makeRequest:serverInterfaceMock key:nil callback:NULL];

[serverInterfaceMock verify];
}

- (void)testBasicSuccess {
NSString * const PRE_RESPONSE_SESSION_ID = @"foo";
NSString * const PRE_RESPONSE_USER_IDENTITY = @"foo";
NSString * const PRE_RESPONSE_IDENTITY = @"foo";
NSString * const PRE_RESPONSE_USER_URL = @"http://foo";
NSString * const PRE_RESPONSE_INSTALL_PARAMS = @"{\"foo\":\"bar\"}";
NSString * const PRE_RESPONSE_SESSION_PARAMS = @"{\"foo\":\"bar\"}";
NSString * const RESPONSE_SESSION_ID = @"bar";
NSString * const RESPONSE_IDENTITY = @"bar";
NSString * const RESPONSE_USER_URL = @"http://bar";

BNCPreferenceHelper *preferenceHelper = [BNCPreferenceHelper sharedInstance];
preferenceHelper.sessionID = PRE_RESPONSE_SESSION_ID;
preferenceHelper.randomizedBundleToken = PRE_RESPONSE_IDENTITY;
preferenceHelper.userUrl = PRE_RESPONSE_USER_URL;
preferenceHelper.userIdentity = PRE_RESPONSE_USER_IDENTITY;
preferenceHelper.installParams = PRE_RESPONSE_INSTALL_PARAMS;
preferenceHelper.sessionParams = PRE_RESPONSE_SESSION_PARAMS;

BNCServerResponse * const goodResponse = [[BNCServerResponse alloc] init];
goodResponse.data = @{
BRANCH_RESPONSE_KEY_SESSION_ID: RESPONSE_SESSION_ID,
BRANCH_RESPONSE_KEY_USER_URL: RESPONSE_USER_URL,
BRANCH_REQUEST_KEY_RANDOMIZED_BUNDLE_TOKEN: RESPONSE_IDENTITY
};

BranchLogoutRequest *request = [[BranchLogoutRequest alloc] init];

[request processResponse:goodResponse error:nil];

XCTAssertEqualObjects(preferenceHelper.randomizedBundleToken, RESPONSE_IDENTITY);
XCTAssertEqualObjects(preferenceHelper.userUrl, RESPONSE_USER_URL);
XCTAssertEqualObjects(preferenceHelper.sessionID, RESPONSE_SESSION_ID);
XCTAssertNil(preferenceHelper.userIdentity);
XCTAssertNil(preferenceHelper.installParams);
XCTAssertNil(preferenceHelper.sessionParams);
}

- (void)testFailureSuccess {
NSString * const PRE_RESPONSE_SESSION_ID = @"foo";
NSString * const PRE_RESPONSE_USER_IDENTITY = @"foo";
NSString * const PRE_RESPONSE_IDENTITY = @"foo";
NSString * const PRE_RESPONSE_USER_URL = @"http://foo";
NSString * const PRE_RESPONSE_INSTALL_PARAMS = @"{\"foo\":\"bar\"}";
NSString * const PRE_RESPONSE_SESSION_PARAMS = @"{\"foo\":\"bar\"}";
NSError * const requestError = [NSError errorWithDomain:@"foo" code:1 userInfo:nil];

BNCPreferenceHelper *preferenceHelper = [BNCPreferenceHelper sharedInstance];
preferenceHelper.sessionID = PRE_RESPONSE_SESSION_ID;
preferenceHelper.randomizedBundleToken = PRE_RESPONSE_IDENTITY;
preferenceHelper.userUrl = PRE_RESPONSE_USER_URL;
preferenceHelper.userIdentity = PRE_RESPONSE_USER_IDENTITY;
preferenceHelper.installParams = PRE_RESPONSE_INSTALL_PARAMS;
preferenceHelper.sessionParams = PRE_RESPONSE_SESSION_PARAMS;


BranchLogoutRequest *request = [[BranchLogoutRequest alloc] init];

[request processResponse:nil error:requestError];

XCTAssertEqualObjects(preferenceHelper.randomizedBundleToken, PRE_RESPONSE_IDENTITY);
XCTAssertEqualObjects(preferenceHelper.userUrl, PRE_RESPONSE_USER_URL);
XCTAssertEqualObjects(preferenceHelper.sessionID, PRE_RESPONSE_SESSION_ID);
XCTAssertEqualObjects(preferenceHelper.userIdentity, PRE_RESPONSE_USER_IDENTITY);
XCTAssertEqualObjects(preferenceHelper.installParams, PRE_RESPONSE_INSTALL_PARAMS);
XCTAssertEqualObjects(preferenceHelper.sessionParams, PRE_RESPONSE_SESSION_PARAMS);
}

@end
Loading

0 comments on commit 9ded4a2

Please sign in to comment.