Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kober32 committed Nov 18, 2024
1 parent 45df228 commit becf3eb
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ jobs:
OP_URL: ${{ secrets.TESTS_OP_URL }}
ER_URL: ${{ secrets.TESTS_ER_URL }}
IN_URL: ${{ secrets.TESTS_IN_URL }}
run: ./scripts/test.sh -destination "platform=iOS Simulator,OS=17.0.1,name=iPhone 15" -sdkconfig "$SDK_CONFIG" -er "$ER_URL" -op "$OP_URL" -in "$IN_URL" -cl "$CL_URL" -clu "$CL_LGN" -clp "$CL_PWD" -cla "$CL_AID"
PU_URL: ${{ secrets.TESTS_PU_URL }}
run: ./scripts/test.sh -destination "platform=iOS Simulator,OS=17.0.1,name=iPhone 15" -sdkconfig "$SDK_CONFIG" -er "$ER_URL" -op "$OP_URL" -in "$IN_URL" -cl "$CL_URL" -clu "$CL_LGN" -clp "$CL_PWD" -cla "$CL_AID" -pu "$PU_URL"
11 changes: 0 additions & 11 deletions WultraMobileTokenSDK/Common/WMTProvisioningUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,6 @@ class WMTProvisioningUtils {
return nil
}
}

static func getApnsEnvironment(profile: WMTProvision?) -> WMTPushRegistrationEnvironment? {
switch profile?.entitlements.apsEnvironment {
case .development:
return .development
case .production:
return .production
case nil:
return nil
}
}
}

/// Provisioning profile plist structure. Note that we need only entitlements for now.
Expand Down
13 changes: 13 additions & 0 deletions WultraMobileTokenSDK/Push/Model/WMTPushRegistrationData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,16 @@ enum WMTPushRegistrationEnvironment: String, Codable {
case production
case development
}

extension WMTProvision {
var apnsEnvironment: WMTPushRegistrationEnvironment? {
switch entitlements.apsEnvironment {
case .development:
return .development
case .production:
return .production
case nil:
return nil
}
}
}
9 changes: 3 additions & 6 deletions WultraMobileTokenSDK/Push/Service/WMTPushImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,9 @@ class WMTPushImpl: WMTPush, WMTService {

private func getPushEnvironment(environment: WMTPushAPNSEnvironment) -> WMTPushRegistrationEnvironment? {
switch environment {
case .development:
return .development
case .production:
return .production
case .automatic:
return WMTProvisioningUtils.getApnsEnvironment(profile: WMTProvisioningUtils.getMainProvisioningProfile())
case .development: return .development
case .production: return .production
case .automatic: return WMTProvisioningUtils.getMainProvisioningProfile()?.apnsEnvironment
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ CL_LGN=""
CL_PWD=""
CL_AID=""
ER_URL=""
PU_URL=""
OP_URL=""
IN_URL=""
SDKCONFIG=""
Expand Down Expand Up @@ -57,6 +58,11 @@ do
shift
shift
;;
-pu)
PU_URL="$2"
shift
shift
;;
-in)
IN_URL="$2"
shift
Expand Down Expand Up @@ -89,6 +95,7 @@ echo """{
\"cloudApplicationId\" : \"${CL_AID}\",
\"enrollmentServerUrl\" : \"${ER_URL}\",
\"operationsServerUrl\" : \"${OP_URL}\",
\"pushServerUrl\". : \"${PU_URL}\",
\"inboxServerUrl\" : \"${IN_URL}\",
\"sdkConfig\" : \"${SDKCONFIG}\"
}""" > "WultraMobileTokenSDKTests/Configs/config.json"
Expand Down

0 comments on commit becf3eb

Please sign in to comment.