Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
avazirna committed Sep 6, 2023
1 parent 73d6a98 commit 9d5df75
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class IdentityCalloutTests {
@JvmField
var intentsRule = ActivityScenarioRule(FormEntryActivity::class.java)

var templates : HashMap<BiometricIdentifier, ByteArray> = HashMap(2)


@Before
fun setup() {
Expand All @@ -50,12 +50,6 @@ class IdentityCalloutTests {
TestAppInstaller.installAppAndLogin(
"jr://resource/commcare-apps/identity_callouts/profile.ccpr",
"test", "123")

// Initialize biometric templates
templates[BiometricIdentifier.LEFT_INDEX_FINGER] =
byteArrayOf(0, 0, -21, -67, 0, -64, 25, 62, -69, -124, -91, 29, -50, -107, 58)
templates[BiometricIdentifier.LEFT_MIDDLE_FINGER] =
byteArrayOf(122, -91, 114, 62, 107, -95, -69, 28, 110, 123, 72, 71, -86, -117, 126)
}

@After
Expand Down Expand Up @@ -110,7 +104,13 @@ class IdentityCalloutTests {
fun testRegistrationWithTemplates() {
val formEntryActivity = ActivityLaunchUtils.launchFormEntry("m0-f1")

intendRegistrationWithTemplatesIntent()
var templates : HashMap<BiometricIdentifier, ByteArray> = HashMap(2)
templates[BiometricIdentifier.LEFT_INDEX_FINGER] =
byteArrayOf(0, 0, -21, -67, 0, -64, 25, 62, -69, -124, -91, 29, -50, -107, 58)
templates[BiometricIdentifier.LEFT_MIDDLE_FINGER] =
byteArrayOf(122, -91, 114, 62, 107, -95, -69, 28, 110, 123, 72, 71, -86, -117, 126)

intendRegistrationWithTemplatesIntent(templates)
performIntentCallout(formEntryActivity)
TestUtils.assertFormValue("/data/guid", "test-case-unique-guid")
TestUtils.assertFormValue("/data/templates",
Expand Down Expand Up @@ -141,7 +141,7 @@ class IdentityCalloutTests {
intending(hasAction("org.commcare.identity.bioenroll")).respondWith(result)
}

private fun intendRegistrationWithTemplatesIntent() {
private fun intendRegistrationWithTemplatesIntent(templates: HashMap<BiometricIdentifier, ByteArray>) {
val registration = IdentityResponseBuilder
.registrationResponse("test-case-unique-guid", templates)
.build()
Expand Down

0 comments on commit 9d5df75

Please sign in to comment.