Ejemplo n.º 1
0
 def test_switch_send_writes_to_transport_iff_the_telex_is_not_empty(self):
     s = Switch()
     s.ipp = selfipp
     s.transport = Mock()
     s.transport.write = Mock()
     empty_tel = Telex()
     s.send(telex=empty_tel, to=End(faripp))
     assert not s.transport.write.called
     tel = Telex(other_dict={'+foo':'bar'})
     s.send(telex=tel, to=End(faripp))
     s.transport.write.assert_called_with(tel.dumps(), faripp)
Ejemplo n.º 2
0
 def test_telex_dumps_to_json(self):
     t = Telex()
     t['+test'] = 'testing'
     assert t.dumps() == '{"+test":"testing"}'