'Testing the handle_packet_as_sender method'

def test_handle_packet_as_sender(self):

    def mocked_handle_error(_dummy1, _dummy2, error_msg=None):
        mocked_handle_error.called = True
    mocked_handle_error.called = False
    self.handler._handle_error = mocked_handle_error
    packet = {'opcode': OPCODE_ERROR}
    self.handler._handle_packet_as_sender(None, packet)
    self.assertTrue(mocked_handle_error.called)
