Skip to content

Commit

Permalink
Identity v3: update appUserID location in /identify (#277)
Browse files Browse the repository at this point in the history
* updated location of the app_user_id param in /identify from the url to the post body

* updated tests
  • Loading branch information
aboedo authored Mar 22, 2021
1 parent b442fa6 commit cb6c424
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,11 @@ class Backend(
enqueue(object : Dispatcher.AsyncCall() {
override fun call(): HTTPClient.Result {
return httpClient.performRequest(
"/subscribers/" + encode(appUserID) + "/identify",
mapOf("new_app_user_id" to newAppUserID),
"/subscribers/identify",
mapOf(
"new_app_user_id" to newAppUserID,
"app_user_id" to appUserID
),
authenticationHeaders
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -964,10 +964,11 @@ class BackendTest {
fun `logIn makes the right http call`() {
val newAppUserID = "newId"
val body = mapOf(
"new_app_user_id" to newAppUserID
"new_app_user_id" to newAppUserID,
"app_user_id" to appUserID
)
mockResponse(
"/subscribers/$appUserID/identify",
"/subscribers/identify",
body,
201,
null,
Expand All @@ -984,7 +985,7 @@ class BackendTest {
)
verify(exactly = 1) {
mockClient.performRequest(
"/subscribers/$appUserID/identify",
"/subscribers/identify",
body,
any()
)
Expand All @@ -995,11 +996,12 @@ class BackendTest {
fun `logIn correctly parses purchaserInfo`() {
val newAppUserID = "newId"
val requestBody = mapOf(
"new_app_user_id" to newAppUserID
"new_app_user_id" to newAppUserID,
"app_user_id" to appUserID
)
val resultBody = Responses.validFullPurchaserResponse
mockResponse(
"/subscribers/$appUserID/identify",
"/subscribers/identify",
requestBody,
responseCode = 201,
clientException = null,
Expand Down Expand Up @@ -1054,11 +1056,12 @@ class BackendTest {
fun `logIn returns created true if status is 201`() {
val newAppUserID = "newId"
val requestBody = mapOf(
"new_app_user_id" to newAppUserID
"new_app_user_id" to newAppUserID,
"app_user_id" to appUserID
)
val resultBody = Responses.validFullPurchaserResponse
mockResponse(
"/subscribers/$appUserID/identify",
"/subscribers/identify",
requestBody,
responseCode = 201,
clientException = null,
Expand All @@ -1080,11 +1083,12 @@ class BackendTest {
fun `logIn returns created false if status isn't 201`() {
val newAppUserID = "newId"
val requestBody = mapOf(
"new_app_user_id" to newAppUserID
"new_app_user_id" to newAppUserID,
"app_user_id" to appUserID
)
val resultBody = Responses.validFullPurchaserResponse
mockResponse(
"/subscribers/$appUserID/identify",
"/subscribers/identify",
requestBody,
responseCode = 200,
clientException = null,
Expand Down

0 comments on commit cb6c424

Please sign in to comment.