'Test that setting type to \'cancel\' clears all fields'

def testCancelType(self):

    msg = self.Message()
    form = msg['form']
    fields = OrderedDict()
    fields['f1'] = {'type': 'text-single', 'label': 'Username', 'required': True}
    fields['f2'] = {'type': 'text-private', 'label': 'Password', 'required': True}
    fields['f3'] = {'type': 'text-multi', 'label': 'Message', 'value': 'Enter    message.\nA    long    one    even.'}
    fields['f4'] = {'type': 'list-single', 'label': 'Message    Type', 'options': [{'label': 'Cool!', 'value': 'cool'}, {'label': 'Urgh!', 'value': 'urgh'}]}
    form.set_fields(fields)
    form['type'] = 'cancel'
    self.check(form, '\n                                        <x    xmlns="jabber:x:data"    type="cancel"    />\n                                ')
