Skip to content

Commit

Permalink
fix: add mock return value to IntegratedTicketers in DashboardTests
Browse files Browse the repository at this point in the history
  • Loading branch information
kallilsouza committed Feb 11, 2025
1 parent 37095f1 commit 2af2b6e
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions chats/apps/api/v1/tests/test_dashboard.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import time
from unittest.mock import patch

from django.urls import reverse
from rest_framework.authtoken.models import Token
Expand Down Expand Up @@ -43,10 +44,15 @@ def test_create_room_metrics(self):
).exists()
self.assertEqual(room_metric, True)

def test_interaction_time_metric_calc(self):
@patch(
"chats.apps.projects.usecases.integrate_ticketers.IntegratedTicketers.integrate__individual_topic"
)
def test_interaction_time_metric_calc(self, mock_integrate):
"""
Verify if the interaction_time of a room metric its calculated correctly.
"""
mock_integrate.return_value = None

url = "/v1/external/rooms/"
client = self.client
client.credentials(
Expand Down Expand Up @@ -86,10 +92,15 @@ def test_interaction_time_metric_calc(self):

self.assertEqual(metric.interaction_time, 3)

def test_message_response_time_metric_calc(self):
@patch(
"chats.apps.projects.usecases.integrate_ticketers.IntegratedTicketers.integrate__individual_topic"
)
def test_message_response_time_metric_calc(self, mock_integrate):
"""
Verify if the message_response_time of a room metric its calculated correctly.
"""
mock_integrate.return_value = None

url = "/v1/external/rooms/"
client = self.client
client.credentials(
Expand Down Expand Up @@ -154,10 +165,15 @@ def test_message_response_time_metric_calc(self):

self.assertEqual(metric.message_response_time, 3)

def test_waiting_time_metric_calc(self):
@patch(
"chats.apps.projects.usecases.integrate_ticketers.IntegratedTicketers.integrate__individual_topic"
)
def test_waiting_time_metric_calc(self, mock_integrate):
"""
Verify if the waiting_time of a room metric its calculated correctly.
"""
mock_integrate.return_value = None

url = "/v1/external/rooms/"
client = self.client
client.credentials(
Expand Down

0 comments on commit 2af2b6e

Please sign in to comment.