You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Change method to POST
* browse timeout tests do not timeout and still need to be fixed
* Update tests
* Lint
* Update tests
* PR comment revisions
* Add params to request body
* Lint
* Create browsebody in constructorio.kt
* Tweaks
Co-authored-by: Zubin Tiku <[email protected]>
Copy file name to clipboardExpand all lines: library/src/test/java/io/constructor/core/ConstructorIoTrackingTest.kt
+23-11Lines changed: 23 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,8 @@ import org.junit.Rule
15
15
importorg.junit.Test
16
16
importjava.net.SocketTimeoutException
17
17
importjava.util.concurrent.TimeUnit
18
+
importkotlin.test.assertEquals
19
+
importkotlin.test.assertTrue
18
20
19
21
classConstructorIoTest {
20
22
@@ -365,8 +367,11 @@ class ConstructorIoTest {
365
367
val observer =ConstructorIo.trackBrowseResultsLoadedInternal("group_id", "Movies", 10).test()
366
368
observer.assertComplete()
367
369
val request = mockServer.takeRequest()
368
-
val path ="/v2/behavioral_action/browse_result_load?filter_name=group_id&filter_value=Movies&num_results=10&action=browse-results&key=copper-key&i=wacko-the-guid&ui=player-three&s=67&c=cioand-2.3.1&_dt=";
370
+
val path ="/v2/behavioral_action/browse_result_load?action=browse-results&key=copper-key&i=wacko-the-guid&ui=player-three&s=67&c=cioand-2.3.1&_dt="
371
+
print(request.body.readUtf8())
369
372
assert(request.path.startsWith(path))
373
+
assertTrue(request.bodySize >220)
374
+
assertEquals("POST", request.method)
370
375
}
371
376
372
377
@Test
@@ -376,8 +381,10 @@ class ConstructorIoTest {
376
381
val observer =ConstructorIo.trackBrowseResultsLoadedInternal("group_id", "Movies", 10).test()
377
382
observer.assertError { true }
378
383
val request = mockServer.takeRequest()
379
-
val path ="/v2/behavioral_action/browse_result_load?filter_name=group_id&filter_value=Movies&num_results=10&action=browse-results&key=copper-key&i=wacko-the-guid&ui=player-three&s=67&c=cioand-2.3.1&_dt=";
384
+
val path ="/v2/behavioral_action/browse_result_load?action=browse-results&key=copper-key&i=wacko-the-guid&ui=player-three&s=67&c=cioand-2.3.1&_dt="
380
385
assert(request.path.startsWith(path))
386
+
assertTrue(request.bodySize >220)
387
+
assertEquals("POST", request.method)
381
388
}
382
389
383
390
@Test
@@ -387,9 +394,8 @@ class ConstructorIoTest {
387
394
mockServer.enqueue(mockResponse)
388
395
val observer =ConstructorIo.trackBrowseResultsLoadedInternal("group_id", "Movies", 10).test()
val path ="/v2/behavioral_action/browse_result_load?filter_name=group_id&filter_value=Movies&num_results=10&action=browse-results&key=copper-key&i=wacko-the-guid&ui=player-three&s=67&c=cioand-2.3.1&_dt=";
392
-
assert(request.path.startsWith(path))
397
+
val request = mockServer.takeRequest(10, TimeUnit.SECONDS)
398
+
assertEquals(null, request)
393
399
}
394
400
395
401
@Test
@@ -399,8 +405,11 @@ class ConstructorIoTest {
399
405
val observer =ConstructorIo.trackBrowseResultClickInternal("group_id", "Movies","TIT-REP-1997", 4).test()
400
406
observer.assertComplete()
401
407
val request = mockServer.takeRequest()
402
-
val path ="/v2/behavioral_action/browse_result_click?filter_name=group_id&filter_value=Movies&customer_id=TIT-REP-1997&result_position_on_page=4&autocomplete_section=Products&key=copper-key&i=wacko-the-guid&ui=player-three&s=67&c=cioand-2.3.1&_dt=";
408
+
val path ="/v2/behavioral_action/browse_result_click?autocomplete_section=Products&key=copper-key&i=wacko-the-guid&ui=player-three&s=67&c=cioand-2.3.1&_dt=";
409
+
print(request.body.readUtf8())
403
410
assert(request.path.startsWith(path))
411
+
assertTrue(request.bodySize >250)
412
+
assertEquals("POST", request.method)
404
413
}
405
414
406
415
@Test
@@ -410,8 +419,10 @@ class ConstructorIoTest {
410
419
val observer =ConstructorIo.trackBrowseResultClickInternal("group_id", "Movies","TIT-REP-1997", 4, "Products", "3467632").test()
411
420
observer.assertComplete()
412
421
val request = mockServer.takeRequest()
413
-
val path ="/v2/behavioral_action/browse_result_click?filter_name=group_id&filter_value=Movies&customer_id=TIT-REP-1997&result_position_on_page=4&autocomplete_section=Products&result_id=3467632&key=copper-key&i=wacko-the-guid&ui=player-three&s=67&c=cioand-2.3.1&_dt=";
422
+
val path ="/v2/behavioral_action/browse_result_click?autocomplete_section=Products&result_id=3467632&key=copper-key&i=wacko-the-guid&ui=player-three&s=67&c=cioand-2.3.1&_dt=";
414
423
assert(request.path.startsWith(path))
424
+
assertTrue(request.bodySize >250)
425
+
assertEquals("POST", request.method)
415
426
}
416
427
417
428
@Test
@@ -421,8 +432,10 @@ class ConstructorIoTest {
421
432
val observer =ConstructorIo.trackBrowseResultClickInternal("group_id", "Movies","TIT-REP-1997", 4).test()
422
433
observer.assertError { true }
423
434
val request = mockServer.takeRequest()
424
-
val path ="/v2/behavioral_action/browse_result_click?filter_name=group_id&filter_value=Movies&customer_id=TIT-REP-1997&result_position_on_page=4&autocomplete_section=Products&key=copper-key&i=wacko-the-guid&ui=player-three&s=67&c=cioand-2.3.1&_dt=";
435
+
val path ="/v2/behavioral_action/browse_result_click?autocomplete_section=Products&key=copper-key&i=wacko-the-guid&ui=player-three&s=67&c=cioand-2.3.1&_dt=";
425
436
assert(request.path.startsWith(path))
437
+
assertTrue(request.bodySize >250)
438
+
assertEquals("POST", request.method)
426
439
}
427
440
428
441
@Test
@@ -432,9 +445,8 @@ class ConstructorIoTest {
432
445
mockServer.enqueue(mockResponse)
433
446
val observer =ConstructorIo.trackBrowseResultClickInternal("group_id", "Movies","TIT-REP-1997", 4).test()
val path ="/v2/behavioral_action/browse_result_click?filter_name=group_id&filter_value=Movies&customer_id=TIT-REP-1997&result_position_on_page=4&autocomplete_section=Products&key=copper-key&i=wacko-the-guid&ui=player-three&s=67&c=cioand-2.3.1&_dt=";
437
-
assert(request.path.startsWith(path))
448
+
val request = mockServer.takeRequest(10, TimeUnit.SECONDS)
0 commit comments