Ejemplo n.º 1
0
 def test_profile_validation_valid_offset_none(self):
     try:
         profile = create_profile_validation(create_json(2),
                                             VALID_SPATIAL_REFERNECES[0],
                                             VALID_NB_POINTS, None)
         self.assertEquals(3, profile.offset)
     except Exception as e:
         logger.error(e, exc_info=True)
         self.fail(
             "These profiles should be valid, and offset should be equal to 3"
         )
Ejemplo n.º 2
0
 def test_profile_validation_valid_nb_points_none(self):
     try:
         profile = create_profile_validation(create_json(2),
                                             VALID_SPATIAL_REFERNECES[0],
                                             None, VALID_OFFSET)
         self.assertEquals(PROFILE_DEFAULT_AMOUNT_POINTS, profile.nb_points)
     except Exception as e:
         logger.error(e, exc_info=True)
         self.fail(
             "These profiles should be valid, and nb points should be equal to {}"
             .format(PROFILE_DEFAULT_AMOUNT_POINTS))
Ejemplo n.º 3
0
 def test_profile_validation_linestring_too_long(self):
     try:
         create_profile_validation(
             create_json(PROFILE_MAX_AMOUNT_POINTS + 210),
             VALID_SPATIAL_REFERNECES[0], VALID_NB_POINTS, VALID_OFFSET)
     except HTTPRequestEntityTooLarge:
         pass
     except Exception as e:
         logger.error(e, exc_info=True)
         self.fail(
             "We should have an http request entity too long exception, something else went wrong."
         )
Ejemplo n.º 4
0
 def test_profile_validation_valid(self):
     try:
         for srid in VALID_SPATIAL_REFERNECES:
             profile = create_profile_validation(create_json(2, srid), srid,
                                                 VALID_NB_POINTS,
                                                 VALID_OFFSET)
             self.assertEquals(srid, profile.spatial_reference)
             self.assertEquals(int(VALID_NB_POINTS), profile.nb_points)
             self.assertEquals(int(VALID_OFFSET), profile.offset)
     except Exception as e:
         logger.error(e, exc_info=True)
         self.fail("These profiles should be valid")
Ejemplo n.º 5
0
 def test_profile_validation_offset_not_int(self):
     try:
         create_profile_validation(create_json(2),
                                   VALID_SPATIAL_REFERNECES[0],
                                   VALID_NB_POINTS, INVALID_OFFSET)
         self.fail("Should not validate")
     except HTTPBadRequest:
         pass
     except Exception as e:
         logger.error(e, exc_info=True)
         self.fail(
             "We should have an http bad request exception, something else went wrong."
         )
Ejemplo n.º 6
0
 def test_profile_validation_nb_points_less_than_two(self):
     try:
         create_profile_validation(create_json(2),
                                   VALID_SPATIAL_REFERNECES[0], "1",
                                   VALID_OFFSET)
         self.fail("Should not validate")
     except HTTPBadRequest:
         pass
     except Exception as e:
         logger.error(e, exc_info=True)
         self.fail(
             "We should have an http bad request exception, something else went wrong."
         )
Ejemplo n.º 7
0
 def test_profile_validation_nb_points_too_big(self):
     try:
         create_profile_validation(create_json(2),
                                   VALID_SPATIAL_REFERNECES[0],
                                   str(PROFILE_MAX_AMOUNT_POINTS + 710),
                                   VALID_OFFSET)
         self.fail("Should not validate")
     except HTTPBadRequest:
         pass
     except Exception as e:
         logger.error(e, exc_info=True)
         self.fail(
             "We should have an http bad request exception, something else went wrong."
         )