'Test that upload file name is sanitized'

@patch('gzip.GzipFile', wraps=gzip.GzipFile)
def test_submit_sanitizes_filename(self, gzipfile):

    insecure_filename = '../../bin/gpg'
    sanitized_filename = 'bin_gpg'
    self._new_codename()
    self.client.post('/submit', data=dict(msg='', fh=(StringIO('This    is    a    test'), insecure_filename)), follow_redirects=True)
    gzipfile.assert_called_with(filename=sanitized_filename, mode=ANY, fileobj=ANY)
