(self)
| 356 | self.assertEqual(response[2]["value"], 1) |
| 357 | |
| 358 | def test_paths_start(self): |
| 359 | _create_person(team_id=self.team.pk, distinct_ids=["person_1"]) |
| 360 | _create_person(team_id=self.team.pk, distinct_ids=["person_2"]) |
| 361 | _create_person(team_id=self.team.pk, distinct_ids=["person_3"]) |
| 362 | _create_person(team_id=self.team.pk, distinct_ids=["person_4"]) |
| 363 | _create_person(team_id=self.team.pk, distinct_ids=["person_5a", "person_5b"]) |
| 364 | |
| 365 | _create_event(properties={"$current_url": "/"}, distinct_id="person_1", event="$pageview", team=self.team), |
| 366 | _create_event( |
| 367 | properties={"$current_url": "/about/"}, distinct_id="person_1", event="$pageview", team=self.team |
| 368 | ), |
| 369 | _create_event(properties={"$current_url": "/"}, distinct_id="person_2", event="$pageview", team=self.team), |
| 370 | _create_event( |
| 371 | properties={"$current_url": "/pricing/"}, distinct_id="person_2", event="$pageview", team=self.team |
| 372 | ), |
| 373 | _create_event( |
| 374 | properties={"$current_url": "/about"}, distinct_id="person_2", event="$pageview", team=self.team |
| 375 | ), |
| 376 | _create_event( |
| 377 | properties={"$current_url": "/pricing"}, distinct_id="person_3", event="$pageview", team=self.team |
| 378 | ), |
| 379 | _create_event(properties={"$current_url": "/"}, distinct_id="person_3", event="$pageview", team=self.team), |
| 380 | _create_event( |
| 381 | properties={"$current_url": "/about/"}, distinct_id="person_3", event="$pageview", team=self.team |
| 382 | ), |
| 383 | _create_event(properties={"$current_url": "/"}, distinct_id="person_4", event="$pageview", team=self.team), |
| 384 | _create_event( |
| 385 | properties={"$current_url": "/pricing/"}, distinct_id="person_4", event="$pageview", team=self.team |
| 386 | ), |
| 387 | _create_event( |
| 388 | properties={"$current_url": "/pricing"}, distinct_id="person_5a", event="$pageview", team=self.team |
| 389 | ), |
| 390 | _create_event( |
| 391 | properties={"$current_url": "/about"}, distinct_id="person_5b", event="$pageview", team=self.team |
| 392 | ), |
| 393 | _create_event( |
| 394 | properties={"$current_url": "/pricing/"}, distinct_id="person_5a", event="$pageview", team=self.team |
| 395 | ), |
| 396 | _create_event( |
| 397 | properties={"$current_url": "/help"}, distinct_id="person_5b", event="$pageview", team=self.team |
| 398 | ), |
| 399 | |
| 400 | response = self.client.get( |
| 401 | f"/api/projects/{self.team.id}/insights/path/?type=%24pageview&start=%2Fpricing" |
| 402 | ).json() |
| 403 | |
| 404 | filter = PathFilter(data={"path_type": "$pageview", "start_point": "/pricing"}) |
| 405 | response = paths(team=self.team, filter=filter).run(team=self.team, filter=filter) |
| 406 | |
| 407 | self.assertEqual(len(response), 5) |
| 408 | |
| 409 | self.assertTrue(response[0].items() >= {"source": "1_/pricing", "target": "2_/about", "value": 2}.items()) |
| 410 | self.assertTrue(response[1].items() >= {"source": "1_/pricing", "target": "2_/", "value": 1}.items()) |
| 411 | self.assertTrue(response[2].items() >= {"source": "2_/", "target": "3_/about", "value": 1}.items()) |
| 412 | self.assertTrue(response[3].items() >= {"source": "2_/about", "target": "3_/pricing", "value": 1}.items()) |
| 413 | self.assertTrue(response[4].items() >= {"source": "3_/pricing", "target": "4_/help", "value": 1}.items()) |
| 414 | |
| 415 | # ensure trailing slashes make no difference |
nothing calls this directly
no test coverage detected