def filename(self): disposition = self.response.headers.get('content-disposition') return get_filename(disposition)
def it_returns_none_if_none_was_passed_in(self): assert get_filename(None) is None
def it_returns_none_if_disposition_is_malformed(self, disposition): assert get_filename(disposition) is None
def it_gets_filename(self): assert get_filename('attachment; filename="fname.ext"') == "fname.ext"
def it_handles_unquoted_filenames(self): assert get_filename('inline; filename=fname.ext') == "fname.ext"