Skip to content

Commit

Permalink
refactor: use cdpApiKey in iOS SDK remaining test cases (#563)
Browse files Browse the repository at this point in the history
  • Loading branch information
ami-aman committed Feb 23, 2024
1 parent 604d374 commit 92492ff
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Tests/DataPipeline/Core/UnitTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ open class UnitTest: SharedTests.UnitTestBase<CustomerIO> {

open func setUp(
enableLogs: Bool = false,
writeKey: String? = nil,
cdpApiKey: String? = nil,
modifySdkConfig: ((SDKConfigBuilder) -> Void)?
) {
let sdkConfigBuilder = SDKConfigBuilder(writeKey: writeKey ?? testWriteKey)
let sdkConfigBuilder = SDKConfigBuilder(cdpApiKey: cdpApiKey ?? testCdpApiKey)
// set sdk log level to debug if logs are enabled
if enableLogs {
sdkConfigBuilder.logLevel(.debug)
Expand Down
4 changes: 2 additions & 2 deletions Tests/DataPipeline/DataPipelineInteractionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class DataPipelineInteractionTests: IntegrationTest {
outputReader = (customerIO.add(plugin: OutputReaderPlugin()) as? OutputReaderPlugin)
}

override func setUp(enableLogs: Bool = false, writeKey: String? = nil, modifySdkConfig: ((SDKConfigBuilder) -> Void)?) {
super.setUp(enableLogs: enableLogs, writeKey: writeKey, modifySdkConfig: modifySdkConfig)
override func setUp(enableLogs: Bool = false, cdpApiKey: String? = nil, modifySdkConfig: ((SDKConfigBuilder) -> Void)?) {
super.setUp(enableLogs: enableLogs, cdpApiKey: cdpApiKey, modifySdkConfig: modifySdkConfig)
// OutputReaderPlugin helps validating interactions with analytics
outputReader = (customerIO.add(plugin: OutputReaderPlugin()) as? OutputReaderPlugin)
}
Expand Down
4 changes: 2 additions & 2 deletions Tests/MessagingPush/HttpTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import XCTest
In order to *run* tests on your local machine, follow these setup steps:
1. In XCode, go to: Edit Scheme > Run
2. Create an environment variables: `WRITE_KEY`. Populate the values with test credentials from a source that you control.
2. Create an environment variables: `CDP_API_KEY`. Populate the values with test credentials from a source that you control.
3. Manually run the tests below. Use the XCode debug console to see the log output for debugging.
*/
open class HttpTest: UnitTest {
Expand All @@ -33,7 +33,7 @@ open class HttpTest: UnitTest {
We don't want to run these tests on a CI server (flaky!) so, only populate the runner if
we see environment variables set in XCode.
*/
if let writeKey = getEnvironmentVariable("CDP_API_KEY") {
if let cdpApiKey = getEnvironmentVariable("CDP_API_KEY") {
cioSession = RichPushHttpClient.getCIOApiSession(
key: cdpApiKey,
userAgentHeaderValue: deviceInfo.getUserAgentHeaderValue()
Expand Down
2 changes: 1 addition & 1 deletion Tests/Tracking/Core/UnitTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ open class UnitTest: SharedTests.UnitTestBase<CustomerIO> {
}

override open func initializeSDKComponents() -> CustomerIO? {
let (_, dataPipelineConfig) = SDKConfigBuilder(writeKey: "")
let (_, dataPipelineConfig) = SDKConfigBuilder(cdpApiKey: "")
// disable auto add destination to prevent tests from sending data to server
.autoAddCustomerIODestination(false)
.build()
Expand Down

0 comments on commit 92492ff

Please sign in to comment.