'Test the header and metadata returned by ``time_to_fits``.'

@pytest.mark.parametrize('table_types', (Table, QTable))
def test_time_to_fits_header(self, table_types):

    t = table_types()
    t['a'] = Time(self.time, format='isot', scale='utc', location=EarthLocation((-2446354), 4237210, 4077985, unit='m'))
    t['b'] = Time([1, 2], format='cxcsec', scale='tt')
    ideal_col_hdr = {'OBSGEO-X': t['a'].location.x.value, 'OBSGEO-Y': t['a'].location.y.value, 'OBSGEO-Z': t['a'].location.z.value}
    (table, hdr) = time_to_fits(t)
    for (key, value) in GLOBAL_TIME_INFO.items():
        assert (hdr[key] == value[0])
        assert (hdr.comments[key] == value[1])
        hdr.remove(key)
    for (key, value) in ideal_col_hdr.items():
        assert (hdr[key] == value)
        hdr.remove(key)
    coord_info = table.meta['__coordinate_columns__']
    for colname in coord_info:
        assert (coord_info[colname]['coord_type'] == t[colname].scale.upper())
        assert (coord_info[colname]['coord_unit'] == 'd')
    assert (coord_info['a']['time_ref_pos'] == 'TOPOCENTER')
    assert (len(hdr) == 0)
