Ejemplo n.º 1
0
 def test_post__anon(self):
     """We reject anon star requests."""
     feature_id = self.feature_1.key().id()
     self.handler.request.body = '{"featureId": %d}' % feature_id
     testing_config.sign_out()
     with self.assertRaises(exc.HTTPClientError):
         self.handler.post()
Ejemplo n.º 2
0
 def test_post__anon(self):
     """Anon cannot edit features, gets a 401."""
     testing_config.sign_out()
     feature_id = self.feature_1.key().id()
     actual = self.handler.post(self.handler.request.path,
                                feature_id=feature_id)
     self.assertIsNone(actual)
     self.assertEqual('401 Unauthorized', self.handler.response.status)
Ejemplo n.º 3
0
 def test_post__anon(self):
   """Anon cannot create features, gets a 401."""
   testing_config.sign_out()
   self.handler.post(self.handler.request.path)
   self.assertEqual('401 Unauthorized', self.handler.response.status)
Ejemplo n.º 4
0
 def test_get__anon(self):
   """Anon cannot create features, gets a redirect to sign in page."""
   testing_config.sign_out()
   self.handler.get(self.handler.request.path)
   self.assertEqual('302 Moved Temporarily', self.handler.response.status)
Ejemplo n.º 5
0
 def test_post__anon(self):
   """Anon cannot edit features, gets a 401."""
   testing_config.sign_out()
   self.handler.post('/guide/stage', self.feature_1.key().id(), self.stage)
   self.assertEqual('401 Unauthorized', self.handler.response.status)
Ejemplo n.º 6
0
 def test_get__anon(self, mock_render):
   """Anon cannot edit features, gets a redirect to viewing page."""
   testing_config.sign_out()
   self.handler.get('/guide/stage', self.feature_1.key().id(), self.stage)
   self.assertEqual('302 Moved Temporarily', self.handler.response.status)
   mock_render.assert_not_called()
Ejemplo n.º 7
0
 def test_post__anon(self):
     """Anon should always have an empty list of stars."""
     testing_config.sign_out()
     self.handler.post()
     self.assertEqual('{"featureIds":[]}', self.handler.response.body)