My code looks roughly like
40 def send_pubkey( s: socket ) -> None:
41 '''Transmit own public key unencrypted.'''
42 _, pub = crypto.read_keypair()
43 s.sendall(pub.save_pkcs1())
This is extremely difficult to test as it involves network operations. However adding another level of abstraction between this layer and OS sockets goes against import this*
. Any silver bullet out there?
* - Simple is better than complex.
import this
" – Philip Kendall Jun 25 '23 at 06:50unittest.mock
? – Ben Cottrell Jun 25 '23 at 07:05import this
concern. – candied_orange Jun 26 '23 at 02:39