示例#1
0
 def test_superuser_all_proposals(self, post_mock, get_mock):
     self.admin_user.backend = settings.AUTHENTICATION_BACKENDS[0]
     self.client.force_login(self.admin_user)
     FrameFactory.create(PROPID='prop1')
     FrameFactory.create(PROPID='prop2')
     self.assertEqual(['prop1', 'prop2'], self.admin_user.profile.proposals)
     self.assertFalse(get_mock.called)
示例#2
0
 def setUp(self):
     boto3.client = MagicMock()
     is_public_date = timezone.now() - datetime.timedelta(days=7)
     is_not_public_date = timezone.now() + datetime.timedelta(days=7)
     FrameFactory.create(OBSTYPE='EXPOSE',
                         TELID='1m0a',
                         SITEID='bpl',
                         INSTRUME='kb46',
                         PROPID='prop1',
                         FILTER='rp',
                         L1PUBDAT=is_public_date)
     FrameFactory.create(OBSTYPE='BIAS',
                         TELID='0m4a',
                         SITEID='coj',
                         INSTRUME='en05',
                         PROPID='prop2',
                         FILTER='V',
                         L1PUBDAT=is_not_public_date)
     FrameFactory.create(OBSTYPE='SKYFLAT',
                         TELID='2m0b',
                         SITEID='ogg',
                         INSTRUME='fl10',
                         PROPID='prop3',
                         FILTER='B',
                         L1PUBDAT=is_public_date)
 def setUp(self):
     is_public_date = timezone.now() - datetime.timedelta(days=7)
     is_not_public_date = timezone.now() + datetime.timedelta(days=7)
     FrameFactory.create(configuration_type='EXPOSE',
                         telescope_id='1m0a',
                         site_id='bpl',
                         instrument_id='kb46',
                         proposal_id='prop1',
                         primary_optical_element='rp',
                         public_date=is_public_date)
     FrameFactory.create(configuration_type='BIAS',
                         telescope_id='0m4a',
                         site_id='coj',
                         instrument_id='en05',
                         proposal_id='prop2',
                         primary_optical_element='V',
                         public_date=is_not_public_date)
     FrameFactory.create(configuration_type='SKYFLAT',
                         telescope_id='2m0b',
                         site_id='ogg',
                         instrument_id='fl10',
                         proposal_id='prop3',
                         primary_optical_element='B',
                         public_date=is_public_date)
示例#4
0
 def test_get_headers(self):
     frame = FrameFactory.create()
     response = self.client.get(reverse('frame-headers', args=(frame.id, )))
     self.assertContains(response, frame.headers.data['TRACKNUM'])
示例#5
0
 def test_get_related(self):
     frame = FrameFactory.create()
     related_frame = FrameFactory.create(related_frames=[frame])
     response = self.client.get(reverse('frame-related', args=(frame.id, )))
     self.assertContains(response, related_frame.basename)