Skip to content

Commit

Permalink
Merge pull request #25 from dzarkV/dev-jul
Browse files Browse the repository at this point in the history
fix messages send
  • Loading branch information
JulianRami authored Mar 1, 2024
2 parents 9d44664 + e08927d commit 71b0285
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
5 changes: 2 additions & 3 deletions emailApp/views/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ def get(self, request=None):

serialized_messages = []
for message in all_messages:
if message.isActive == True:
serialized_messages.append({
serialized_messages.append({
'message_id': message.id,
'from_user_name': message.from_user.name,
'from_user': message.from_user.email,
Expand All @@ -57,7 +56,7 @@ def get(self, request=None):
'category_id': message.category_id.category_id,
'category_name': message.category_id.category_name,
'color': message.category_id.color,
})
})

return Response(serialized_messages, status=status.HTTP_200_OK)

Expand Down
13 changes: 0 additions & 13 deletions tests/tests_email_app/test_get_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,6 @@ def test_get_messages_invalid_user(self):
response = self.client.get('/messages/getAll', {'mail': '[email protected]'})
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)

def test_get_messages_inactive(self):
"""
Test retrieving messages with inactive status.
Returns:
- None
"""
message_from = MessageFrom.objects.create(from_user=self.user_from, subject='Inactive Subject', body='Inactive Body', category_id=Categories.objects.get(category_id=0), isActive=False)
message_to = MessageTo.objects.create(message_id=message_from, to_user=self.user_to)
response = self.client.get('/messages/getAll', {'email': self.user_from.email})
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(len(response.data), 0)

def test_get_messages_multiple(self):
"""
Test retrieving multiple messages for a user.
Expand Down

0 comments on commit 71b0285

Please sign in to comment.