Skip to content

Commit

Permalink
fix: removing broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanJaeger committed Feb 6, 2025
1 parent f2b7ce8 commit d92cfe2
Showing 1 changed file with 35 additions and 43 deletions.
78 changes: 35 additions & 43 deletions chats/apps/api/v1/tests/test_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,49 +43,6 @@ def test_create_room_metrics(self):
).exists()
self.assertEqual(room_metric, True)

def test_interaction_time_metric_calc(self):
"""
Verify if the interaction_time of a room metric its calculated correctly.
"""
url = "/v1/external/rooms/"
client = self.client
client.credentials(
HTTP_AUTHORIZATION="Bearer f3ce543e-d77e-4508-9140-15c95752a380"
)
data = {
"user_email": str(self.manager_user),
"queue_uuid": str(self.queue_1.uuid),
"contact": {
"external_id": "e3955fd5-5705-55cd-b480-b45594b70282",
"name": "Foo Bar",
"email": "FooBar@weni.ai",
"phone": "+250788123123",
"custom_fields": {},
},
}
client.post(url, data=data, format="json")
room_created = Room.objects.get(queue_id=data["queue_uuid"])
room_created.user = self.manager_user
room_created.save()

time.sleep(3)

url_close = f"/v1/room/{room_created.uuid}/close/"
close_client = self.client
close_client.credentials(HTTP_AUTHORIZATION="Token " + self.login_token.key)
data_close = {
"tags": [
"f4b8aa78-7735-4dd2-9999-941ebb8e4e35",
"1a84b46e-0f91-41da-ac9d-a68c0b9753ab",
]
}
client.patch(url_close, data=data_close, format="json")

room_closed = Room.objects.get(queue_id=data["queue_uuid"])
metric = RoomMetrics.objects.get(room=room_closed)

self.assertEqual(metric.interaction_time, 3)

def test_message_response_time_metric_calc(self):
"""
Verify if the message_response_time of a room metric its calculated correctly.
Expand Down Expand Up @@ -154,6 +111,41 @@ def test_message_response_time_metric_calc(self):

self.assertEqual(metric.message_response_time, 3)

def test_waiting_time_metric_calc(self):
"""
Verify if the waiting_time of a room metric its calculated correctly.
"""
url = "/v1/external/rooms/"
client = self.client
client.credentials(
HTTP_AUTHORIZATION="Bearer f3ce543e-d77e-4508-9140-15c95752a380"
)
data = {
"queue_uuid": str(self.queue_1.uuid),
"contact": {
"external_id": "e3955fd5-5705-77cd-b480-b45594b70282",
"name": "Foo Bar",
"email": "FooBar@weni.ai",
"phone": "+250788123123",
"custom_fields": {},
},
}
client.post(url, data=data, format="json")
room_created = Room.objects.get(queue_id=data["queue_uuid"])

time.sleep(3)

url_patch = f"/v1/room/{room_created.uuid}/"
patch_client = self.client
patch_client.credentials(HTTP_AUTHORIZATION="Token " + self.login_token.key)
data_update = {"user_email": str(self.manager_user)}
patch_client.patch(url_patch, data=data_update, format="json")

room_closed = Room.objects.get(queue_id=data["queue_uuid"])
metric = RoomMetrics.objects.get(room=room_closed)

self.assertEqual(metric.waiting_time, 3)

def test_dashboard_model_name_property(self):
url = reverse("external_rooms-list")
client = self.client
Expand Down

0 comments on commit d92cfe2

Please sign in to comment.