def METHOD_NAME(self, n_ifos, n_ifos_extra):
    # choose a random selection of interferometers
    # n_ifos will be used to generate the simulated trigger including
    # significance followup
    # n_ifos_extra will be used for sky loc only
    all_ifos = random.sample(self.possible_ifos, n_ifos + n_ifos_extra)
    trig_ifos = all_ifos[0:n_ifos]
    # take 2 ifos to represent the initial coinc trigger
    coinc_ifos = all_ifos[0:2]
    results = {'foreground/stat': np.random.uniform(4, 20),
               'foreground/ifar': np.random.uniform(0.01, 1000)}
    skyloc_data = {}
    for ifo in all_ifos:
        offset = 10000 + np.random.uniform(-0.02, 0.02)
        amplitude = np.random.uniform(4, 20)
        # generate a mock SNR time series with a peak
        n = 201
        dt = 1. / 2048.
        t = np.arange(n) * dt
        t_peak = dt * n / 2
        snr = np.exp(-(t - t_peak) ** 2 * 3e-3 ** -2) * amplitude
        snr_series = TimeSeries((snr + 1j * 0).astype(np.complex64),
                                delta_t=dt, epoch=offset)
        # generate a mock PSD
        psd_samples = np.random.exponential(size=1024)
        psd = FrequencySeries(psd_samples, delta_f=1.)
        # fill in the various fields
        if ifo in trig_ifos:
            base = 'foreground/' + ifo + '/'
            results[base + 'end_time'] = t_peak + offset
            results[base + 'snr'] = amplitude
            results[base + 'sigmasq'] = np.random.uniform(1e6, 2e6)
        skyloc_data[ifo] = {'snr_series': snr_series,
                              'psd': psd}
    for ifo, k in itertools.product(trig_ifos, self.template):
        results['foreground/' + ifo + '/' + k] = self.template[k]
    channel_names = {ifo: 'TEST' for ifo in all_ifos}
    kwargs = {'psds': {ifo: skyloc_data[ifo]['psd'] for ifo in all_ifos},
              'low_frequency_cutoff': 20.,
              'skyloc_data': skyloc_data,
              'channel_names': channel_names}
    coinc = CandidateForGraceDB(coinc_ifos, trig_ifos, results, **kwargs)
    tempdir = tempfile.mkdtemp()
    coinc_file_name = os.path.join(tempdir, 'coinc.xml.gz')
    if GraceDb is not None:
        # pretend to upload the event to GraceDB.
        # The upload will fail, but it should not raise an exception
        # and it should still leave the event file around
        coinc.upload(coinc_file_name, gracedb_server='localhost',
                     testing=True)
    else:
        # no GraceDb module, so just save the coinc file
        coinc.save(coinc_file_name)
    # read back and check the coinc document
    read_coinc = ligolw_utils.load_filename(
            coinc_file_name, verbose=False,
            contenthandler=LIGOLWContentHandler)
    single_table = lsctables.SnglInspiralTable.get_table(read_coinc)
    self.assertEqual(len(single_table), len(all_ifos))
    coinc_table = lsctables.CoincInspiralTable.get_table(read_coinc)
    self.assertEqual(len(coinc_table), 1)
    # make sure lalseries can read the PSDs
    psd_doc = ligolw_utils.load_filename(
            coinc_file_name, verbose=False,
            contenthandler=lalseries.PSDContentHandler)
    psd_dict = lalseries.read_psd_xmldoc(psd_doc)
    self.assertEqual(set(psd_dict.keys()), set(all_ifos))
    shutil.rmtree(tempdir)