Пример #1
0
 def test_embedded(self) -> None:
     """Test embedded method to check JSON-serialization and auto-join."""
     assert Source.from_name('antares').to_json(join=True) == {
         'id': 2,
         'type_id': 3,
         'facility_id': None,
         'user_id': None,
         'name': 'antares',
         'description':
         'Antares is an alert broker developed by NOAO for ZTF and LSST.',
         'data': {},
         'type': {
             'id': 3,
             'name': 'broker',
             'description': 'Alerts from data brokers.'
         }
     }
Пример #2
0
 def test_name_missing(self) -> None:
     """Test exception on missing source `name`."""
     with pytest.raises(NotFound):
         Source.from_name('Missing Source Name')
Пример #3
0
 def test_from_name(self, testdata: TestData) -> None:
     """Test loading source from `name`."""
     for record in testdata['source']:
         assert Source.from_name(record['name']).name == record['name']