Exemple #1
0
    def test_get_facility(self):
        # Default facility from template configuration file.
        self.assertEqual(
            [x.__name__ for x in config.get_facilities()],
            ['Generic'])

        # Facility by plain class name.
        self.assertEqual(
            [x.__name__ for x in config.get_facilities(facility_spec='JCMT')],
            ['JCMT'])

        # Facilities by full module and class name.
        self.assertEqual(
            [x.__name__ for x in config.get_facilities(
                facility_spec='hedwig.facility.generic.view.Generic,'
                'hedwig.facility.jcmt.view.JCMT')],
            ['Generic', 'JCMT'])
    def setUp(self):
        super(FacilityTestCase, self).setUp()

        self.id_cache = {}

        facilities = get_facilities(facility_spec=self.facility_spec)
        assert len(facilities) == 1
        facility_class = facilities[0]

        self.facility_id = self.db.ensure_facility(facility_class.get_code())

        self.view = facility_class(self.facility_id)
Exemple #3
0
    def setUp(self):
        super(FacilityTestCase, self).setUp()

        self.id_cache = {}

        facilities = get_facilities(facility_spec=self.facility_spec)
        assert len(facilities) == 1
        facility_class = facilities[0]

        self.facility_id = self.db.ensure_facility(facility_class.get_code())

        self.view = facility_class(self.facility_id)
Exemple #4
0
    def test_facilities(self):
        facilities = config.get_facilities()

        self.assertIsInstance(facilities, list)
        for facility in facilities:
            self.assertIsInstance(facility, type)