Ejemplo n.º 1
0
 def test_area_intersects(self):
     frame = PublicFrameFactory.create(
         area='POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))')
     response = self.client.get(
         reverse('frame-list') +
         '?intersects=POLYGON((-10 -10, -10 20, 20 20, 20 0, -10 -10))')
     self.assertContains(response, frame.basename)
Ejemplo n.º 2
0
    def test_rlevel(self):
        frame = PublicFrameFactory(RLEVEL=10)
        response = self.client.get(reverse('frame-list') + '?RLEVEL=10')
        self.assertContains(response, frame.basename)

        response = self.client.get(reverse('frame-list') + '?RLEVEL=11')
        self.assertNotContains(response, frame.basename)
Ejemplo n.º 3
0
    def test_filters_public(self):
        user = User.objects.create(username='******', password='******')
        Profile.objects.create(user=user)
        user.backend = settings.AUTHENTICATION_BACKENDS[0]
        responses.add(responses.GET,
                      settings.OAUTH_CLIENT['PROFILE_URL'],
                      body=json.dumps({'proposals': [{
                          'id': 'prop1'
                      }]}),
                      status=200,
                      content_type='application/json')
        self.client.force_login(user)
        proposal_frame = FrameFactory(L1PUBDAT=datetime.datetime(2999,
                                                                 1,
                                                                 1,
                                                                 tzinfo=UTC),
                                      PROPID='prop1')
        public_frame = PublicFrameFactory()

        for false_string in ['false', 'False', '0']:
            response = self.client.get(
                reverse('frame-list') + '?public={}'.format(false_string))
            self.assertContains(response, proposal_frame.basename)
            self.assertNotContains(response, public_frame.basename)

        self.client.logout()

        for false_string in ['false', 'False', '0']:
            response = self.client.get(
                reverse('frame-list') + '?public={}'.format(false_string))
            self.assertNotContains(response, proposal_frame.basename)
            self.assertNotContains(response, public_frame.basename)
Ejemplo n.º 4
0
 def test_exptime(self):
     frame = PublicFrameFactory(EXPTIME=300)
     response = self.client.get(reverse('frame-list') + '?EXPTIME=300')
     self.assertContains(response, frame.basename)
     response = self.client.get(reverse('frame-list') + '?EXPTIME=200')
     self.assertContains(response, frame.basename)
     response = self.client.get(reverse('frame-list') + '?EXPTIME=900')
     self.assertNotContains(response, frame.basename)
Ejemplo n.º 5
0
 def test_object(self):
     frame = PublicFrameFactory(OBJECT='planet9')
     response = self.client.get(reverse('frame-list') + '?OBJECT=planet')
     self.assertContains(response, frame.basename)
     response = self.client.get(reverse('frame-list') + '?OBJECT=planet9')
     self.assertContains(response, frame.basename)
     response = self.client.get(reverse('frame-list') + '?OBJECT=mars')
     self.assertNotContains(response, frame.basename)
Ejemplo n.º 6
0
 def test_area_covers_wrap_0ra(self):
     frame = PublicFrameFactory.create(
         area='POLYGON((350 -10, 350 10, 10 10, 10 -10, 350 -10))')
     response = self.client.get('{0}?covers=POINT(0 0)'.format(
         reverse('frame-list')))
     self.assertContains(response, frame.basename)
     response = self.client.get('{0}?covers=POINT(340 0)'.format(
         reverse('frame-list')))
     self.assertNotContains(response, frame.basename)
Ejemplo n.º 7
0
 def test_area_covers(self):
     frame = PublicFrameFactory.create(
         area='POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))')
     response = self.client.get('{0}?covers=POINT(5 5)'.format(
         reverse('frame-list')))
     self.assertContains(response, frame.basename)
     response = self.client.get('{0}?covers=POINT(20 20)'.format(
         reverse('frame-list')))
     self.assertNotContains(response, frame.basename)
Ejemplo n.º 8
0
 def test_basename(self):
     frame = PublicFrameFactory(basename='allyourbase')
     response = self.client.get(reverse('frame-list') + '?basename=allyour')
     self.assertContains(response, frame.basename)
     response = self.client.get(
         reverse('frame-list') + '?basename=allyourbase')
     self.assertContains(response, frame.basename)
     response = self.client.get(reverse('frame-list') + '?basename=cats')
     self.assertNotContains(response, frame.basename)
Ejemplo n.º 9
0
 def test_start_end(self):
     frame = PublicFrameFactory(
         DATE_OBS=datetime.datetime(2011, 2, 1, tzinfo=UTC))
     response = self.client.get(
         reverse('frame-list') + '?start=2011-01-01&end=2011-03-01')
     self.assertContains(response, frame.basename)
     response = self.client.get(
         reverse('frame-list') + '?start=2012-01-01&end=2012-03-01')
     self.assertNotContains(response, frame.basename)