def test_get_collections(self): cadc = Cadc() result = cadc.get_collections() assert len(result) > 10 # test for the presence of a few known collections assert 'CFHT' in result assert 'Infrared' in result['CFHT']['Bands'] assert 'Optical' in result['CFHT']['Bands'] assert 'MOST' in result assert 'Optical' in result['MOST']['Bands'] assert 'GEMINI' in result assert 'Infrared' in result['GEMINI']['Bands'] assert 'Optical' in result['GEMINI']['Bands'] assert 'JCMT' in result assert 'Millimeter' in result['JCMT']['Bands'] assert 'DAO' in result assert 'Infrared' in result['DAO']['Bands'] assert 'Optical' in result['DAO']['Bands']
def test_get_collections(): cadc = Cadc() def mock_run_query(query, output_format=None, maxrec=None, output_file=None): assert query == \ 'select distinct collection, energy_emBand from caom2.EnumField' assert output_format is None assert maxrec is None assert output_file is None table = AstroTable(rows=[('CFHT', 'Optical'), ('CFHT', 'Infrared'), ('JCMT', 'Millimeter'), ('DAO', 'Optical'), ('DAO', 'Infrared')], names=('collection', 'energy_emBand')) return table cadc.exec_sync = mock_run_query result = cadc.get_collections() assert len(result) == 3 assert 'CFHT' in result assert 'JCMT' in result assert 'DAO' in result