import unittest
import client
from tkinter import Tk
from unittest.mock import patch
class TestClient(unittest.TestCase):
@patch('client.Client.socket')
def test_send(self, mock_socket):
test_client = client.Client(Tk())
test_client.send('TESTING')
mock_socket.send.assert_called_with(unittest.mock.ANY)
I asked a similar question about similar code. Then I refactored to the shown code. When I execute this with python -m unittest I get:
AttributeError: does not have the attribute 'socket'
I have no idea where the first client. is coming from.
Aucun commentaire:
Enregistrer un commentaire