def test_quit_no_protocol(self): tor = Tor(Mock(), Mock()) tor._protocol = None tor._process_protocol = None with self.assertRaises(RuntimeError) as ctx: yield tor.quit() self.assertTrue('no protocol instance' in str(ctx.exception))
def test_quit(self): tor = Tor(Mock(), Mock()) tor._protocol = Mock() tor._process_protocol = Mock() yield tor.quit()