Beispiel #1
0
    def test_get_rise_set_against_lco_rise_set(self):
        facility = FakeFacility()
        sites = facility.get_observing_sites()
        start = datetime(2018, 10, 10)
        end = datetime(2018, 10, 11)

        # Get sunrise/set from rise-set library
        coj = {
            'latitude': Angle(degrees=sites.get('Siding Spring')['latitude']),
            'longitude': Angle(degrees=sites.get('Siding Spring')['longitude'])
        }
        coj_observer = observer_for_site(sites.get('Siding Spring'))
        (transit, control_rise,
         control_set) = calc_sunrise_set(coj, start, 'sunrise')

        # Get rise/set from observations module
        rise_set = get_rise_set(coj_observer, self.sun, start, end)
        rise_delta = timedelta(hours=rise_set[0][0].hour,
                               minutes=rise_set[0][0].minute,
                               seconds=rise_set[0][0].second)
        set_delta = timedelta(hours=rise_set[0][1].hour,
                              minutes=rise_set[0][1].minute,
                              seconds=rise_set[0][1].second)
        self.assertLessEqual(rise_delta - control_rise,
                             abs(timedelta(minutes=5)))
        self.assertLessEqual(set_delta - control_set,
                             abs(timedelta(minutes=5)))
Beispiel #2
0
 def test_observation_detail(self):
     response = self.client.get(
         reverse('tom_observations:detail',
                 kwargs={'pk': self.observation_record.id}))
     self.assertEqual(response.status_code, 200)
     self.assertContains(
         response,
         FakeFacility().get_observation_url(
             self.observation_record.observation_id))
Beispiel #3
0
 def test_update_all_observations_for_facility(self):
     with mock.patch.object(FakeFacility,
                            'update_observation_status') as uos_mock:
         FakeFacility().update_all_observation_statuses()
         self.assertEquals(uos_mock.call_count, 2)
Beispiel #4
0
 def test_update_individual_target_observations_for_facility(self):
     with mock.patch.object(FakeFacility,
                            'update_observation_status',
                            return_value='COMPLETED') as uos_mock:
         FakeFacility().update_all_observation_statuses(target=self.t1)
         self.assertEquals(uos_mock.call_count, 2)