Skip to content

Commit

Permalink
trying something
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFJcurve committed Nov 30, 2024
1 parent 5402eaf commit 3132bfb
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion backend/test/test_p2p_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import socket
import unittest

from code.client_message import ClientMessage, MessageType, MessageError
from code.p2p_client import P2PClient


Expand All @@ -25,10 +26,24 @@ def test_init(self):
self.assertTrue(isinstance(test_client.__discovery_socket__, socket.socket))
self.assertTrue(isinstance(test_client.__chat_socket__, socket.socket))

def test_start_runs_threads_in_correct_order(self):
def test_start_throws_no_exception(self):
"""
Start function should throw no exceptions
"""

with P2PClient() as test_client:
test_client.start()

def test_request_file_sends_correct_client_message(self):
"""
We should be requesting for the correct file
"""

test_file_id = 1

with P2PClient() as test_client:
test_client_message = ClientMessage()
test_client_message.type = MessageType.REQUEST_FILE
test_client_message.user_id = test_client.__user_id__
test_client_message.file_id = test_file_id
test_client_message.error = MessageError.NO_ERROR

0 comments on commit 3132bfb

Please sign in to comment.