def got_send_iq(self): SendFileTest.got_send_iq(self) # Receiver declines the file offer reply = domish.Element(('jabber:client', 'iq')) reply['to'] = 'test@localhost/Resource' reply['from'] = self.iq['to'] reply['type'] = 'error' reply['id'] = self.iq['id'] error = reply.addElement((None, 'error')) error['code'] = '403' error['type'] = 'cancel' forbidden = error.addElement((ns.STANZA, 'forbidden')) text = error.addElement((ns.STANZA, 'text'), content='Offer Declined') self.stream.send(reply) e = self.q.expect('dbus-signal', signal='FileTransferStateChanged') state, reason = e.args assert state == cs.FT_STATE_CANCELLED, state assert reason == cs.FT_STATE_CHANGE_REASON_REMOTE_STOPPED transferred = self.ft_props.Get(cs.CHANNEL_TYPE_FILE_TRANSFER, 'TransferredBytes') # no byte has been transferred as the file was declined assert transferred == 0 # try to provide the file, assert that this finishes the test (e.g. # couldn't go further because of ipv6) or that it raises # cs.NOT_AVAILABLE try: assert self.provide_file() except dbus.DBusException, e: assert e.get_dbus_name() == cs.NOT_AVAILABLE
def got_send_iq(self): SendFileTest.got_send_iq(self) # Receiver declines the file offer reply = domish.Element(('', 'iq')) reply['to'] = self.iq['from'] reply['type'] = 'error' reply['id'] = self.iq['id'] error_node = reply.addElement((None, 'error'), content='User declined to receive the file') error_node['type'] = '406' self.incoming.send(reply) e = self.q.expect('dbus-signal', signal='FileTransferStateChanged') state, reason = e.args assert state == cs.FT_STATE_CANCELLED, state assert reason == cs.FT_STATE_CHANGE_REASON_REMOTE_STOPPED transferred = self.ft_props.Get(cs.CHANNEL_TYPE_FILE_TRANSFER, 'TransferredBytes') # no byte has been transferred as the file was declined assert transferred == 0 self.channel.Close() self.q.expect('dbus-signal', signal='Closed') # stop test return True
def got_send_iq(self): SendFileTest.got_send_iq(self) # Receiver declines the file offer reply = domish.Element(('jabber:client', 'iq')) reply['to'] = 'test@localhost/Resource' reply['from'] = self.iq['to'] reply['type'] = 'error' reply['id'] = self.iq['id'] error = reply.addElement((None, 'error')) error['code'] = '403' error['type'] = 'cancel' error.addElement((ns.STANZA, 'forbidden')) error.addElement((ns.STANZA, 'text'), content='Offer Declined') self.stream.send(reply) e = self.q.expect('dbus-signal', signal='FileTransferStateChanged') state, reason = e.args assert state == cs.FT_STATE_CANCELLED, state assert reason == cs.FT_STATE_CHANGE_REASON_REMOTE_STOPPED transferred = self.ft_props.Get(cs.CHANNEL_TYPE_FILE_TRANSFER, 'TransferredBytes') # no byte has been transferred as the file was declined assert transferred == 0 # try to provide the file, assert that this finishes the test (e.g. # couldn't go further because of ipv6) or that it raises # cs.NOT_AVAILABLE try: assert self.provide_file() except dbus.DBusException as e: assert e.get_dbus_name() == cs.NOT_AVAILABLE # stop test return True
def got_send_iq(self): SendFileTest.got_send_iq(self) # Receiver declines the file offer reply = domish.Element(('', 'iq')) reply['to'] = self.iq['from'] reply['from'] = self.iq['to'] reply['type'] = 'error' reply['id'] = self.iq['id'] query = reply.addElement(('jabber:iq:oob', 'query')) url_node = query.addElement('url', content=self.url) query.addElement('desc', content=self.desc) error_node = reply.addElement((None, 'error')) error_node['code'] = '406' error_node['type'] = 'modify' not_acceptable_node = error_node.addElement(('urn:ietf:params:xml:ns:xmpp-stanzas', 'not-acceptable')) self.incoming.send(reply) e = self.q.expect('dbus-signal', signal='FileTransferStateChanged') state, reason = e.args assert state == cs.FT_STATE_CANCELLED, state assert reason == cs.FT_STATE_CHANGE_REASON_REMOTE_STOPPED transferred = self.ft_props.Get(cs.CHANNEL_TYPE_FILE_TRANSFER, 'TransferredBytes') # no byte has been transferred as the file was declined assert transferred == 0 # stop test return True