Skip to content

Commit 39fb63d

Browse files
@W-21933885: [MSDK Android] App Attestation Implementation (Improve Test Naming, Resolve To-Dos)
1 parent 65b82aa commit 39fb63d

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/auth/AppAttestationClientTest.kt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import com.google.android.play.core.integrity.StandardIntegrityManager.StandardI
3434
import com.google.android.play.core.integrity.StandardIntegrityManager.StandardIntegrityTokenProvider
3535
import com.salesforce.androidsdk.rest.RestClient
3636
import com.salesforce.androidsdk.rest.RestResponse
37-
import com.salesforce.androidsdk.util.SalesforceSDKLogger.i
3837
import io.mockk.coEvery
3938
import io.mockk.every
4039
import io.mockk.mockk
@@ -52,7 +51,7 @@ import org.junit.runner.RunWith
5251
class AppAttestationClientTest {
5352

5453
@Test
55-
fun testPrepareIntegrityTokenProvider() {
54+
fun appAttestationClient_prepareIntegrityTokenProvider_returnsSuccessfully() {
5655

5756
val context = mockk<Context>(relaxed = true)
5857
val deviceId = "123456"
@@ -80,16 +79,15 @@ class AppAttestationClientTest {
8079

8180
verify(exactly = 1) {
8281
integrityManager.prepareIntegrityToken(match {
83-
i(javaClass.name, it.toString()) // TODO: Determine how to verify the Google Cloud Project ID was set. ECJ20260411
84-
true
82+
it.toString().contains("cloudProjectNumber=654321")
8583
})
8684
}
8785
verify(exactly = 1) { integrityTokenProviderTask.addOnSuccessListener(any()) }
8886
verify(exactly = 1) { integrityTokenProviderTask.addOnFailureListener(any()) }
8987
}
9088

9189
@Test
92-
fun testOnPrepareIntegrityTokenProviderSuccess() {
90+
fun appAttestationClient_onPrepareIntegrityTokenProviderSuccess_assignsIntegrityTokenProvider() {
9391

9492
val context = mockk<Context>(relaxed = true)
9593
val deviceId = "123456"
@@ -115,7 +113,7 @@ class AppAttestationClientTest {
115113
}
116114

117115
@Test
118-
fun testOnPrepareIntegrityTokenProviderFailure() {
116+
fun appAttestationClient_onPrepareIntegrityTokenProviderFailure_justRuns() {
119117

120118
val context = mockk<Context>(relaxed = true)
121119
val deviceId = "123456"
@@ -140,7 +138,7 @@ class AppAttestationClientTest {
140138

141139
@OptIn(ExperimentalCoroutinesApi::class)
142140
@Test
143-
fun testCreateSalesforceOAuthAuthorizationAppAttestation() = runTest {
141+
fun appAttestationClient_createSalesforceOAuthAuthorizationAppAttestation_returnsSuccessfully() = runTest {
144142

145143
val context = mockk<Context>(relaxed = true)
146144
val deviceId = "123456"
@@ -181,7 +179,7 @@ class AppAttestationClientTest {
181179

182180
@OptIn(ExperimentalCoroutinesApi::class)
183181
@Test
184-
fun appAttestationClient_createAttestationWhenIntegrityTokenProviderIsNull_returns() = runTest {
182+
fun appAttestationClient_createSalesforceOAuthAuthorizationAppAttestationWhenIntegrityTokenProviderIsNull_returnsSuccessfully() = runTest {
185183

186184
val context = mockk<Context>(relaxed = true)
187185
val deviceId = "123456"

0 commit comments

Comments
 (0)