diff --git a/docs/source/geospaas.rst b/docs/source/geospaas.rst index 0d94ee4a..8d69c49e 100644 --- a/docs/source/geospaas.rst +++ b/docs/source/geospaas.rst @@ -32,13 +32,7 @@ geospaas.models module :undoc-members: :show-inheritance: -geospaas.urls module --------------------- -.. automodule:: geospaas.urls - :members: - :undoc-members: - :show-inheritance: Module contents diff --git a/geospaas/catalog/tests.py b/geospaas/catalog/tests.py index aaea4e26..4d184058 100644 --- a/geospaas/catalog/tests.py +++ b/geospaas/catalog/tests.py @@ -173,16 +173,17 @@ def test_unique_constraint_geographic_location(self): with self.assertRaises(django.db.utils.IntegrityError): geolocation2.save() - def test__reproduce__not_null_constraint_failed(self): + def test_GeographicLocation_object_creation_and_uniqueness(self): + """Test that GeographicLocation object can be created with high and low precision of + numbers (db can handle both cases). In addition, the same GeographicLocation can't + be created twice""" geom_wkt = 'POLYGON((1.9952502916543926 43.079137301616434,1.8083614437225106 43.110281163194,1.6280391132319614 43.13999933989308,1.4543047771860391 43.168322409488,1.287178802518546 43.19527992537942,1.126680477150093 43.22090040126175,0.9728280404789855 43.24521129666272,0.8256387132257121 43.26823900332679,0.6851287265540695 43.2900088324148,0.5513133503959514 43.31054500249216,0.4177032107533156 43.3308546554019,0.4177032107533156 43.3308546554019,0.31209072545607186 42.966172534807384,0.2072770834059167 42.60138984322352,0.10324224766647609 42.23651548835664,-3.327518831779395e-05 41.87155835974214,-0.10256845388361147 41.50652732885059,-0.20438175048840848 41.14143124914533,-0.305491137731497 40.776278956093606,-0.4059141156224018 40.4110792671334,-0.5056677274094622 40.045840981598744,-0.6188735003262834 39.62838980058282,-0.6188735003262834 39.62838980058282,-0.4938090620192412 39.60834071737128,-0.36846516623385345 39.58812662484392,-0.2367679070115216 39.566753658618175,-0.09872965092928164 39.54419980869909,0.045636463325510676 39.520442055142105,0.19631650129236156 39.49545637806485,0.35329570832956364 39.469217768317954,0.516558484513175 39.441700238839005,0.686088358898322 39.412876836714965,0.8618679632011015 39.382719655976956,0.8618679632011015 39.382719655976956,0.985334472893415 39.799577386800905,1.0941941665822539 40.164279112775866,1.2038450353475123 40.52892574316672,1.3143064728956748 40.89350812553239,1.425598388091744 41.25801708090206,1.5377412226553768 41.622443403572326,1.6507559695776892 41.98677786085107,1.764664192292795 42.351011192745254,1.8794880446399878 42.71513411159017,1.9952502916543926 43.079137301616434))' - with self.assertRaises(django.db.utils.IntegrityError): - gg, created = GeographicLocation.objects.get_or_create(geometry=WKTReader().read(geom_wkt)) + gg, created = GeographicLocation.objects.get_or_create(geometry=WKTReader().read(geom_wkt)) geom_wkt = 'POLYGON((1.995 43.079,1.808 43.1102,1.628 43.139,1.454 43.168,1.287 43.195,1.126 43.220,0.972 43.245,0.825 43.268,0.685 43.290,0.551 43.310,0.417 43.330,0.417 43.330,0.312 42.966,0.207 42.601,0.103 42.236,0.0 41.871,-0.102 41.506,-0.204 41.141,-0.305 40.776,-0.405 40.411,-0.505 40.045,-0.618 39.628,-0.618 39.628,-0.493 39.608,-0.368 39.588,-0.236 39.566,-0.098 39.544,0.0456 39.520,0.196 39.495,0.353 39.469,0.516 39.441,0.686 39.412,0.861 39.382,0.861 39.382,0.985 39.799,1.094 40.164,1.203 40.528,1.314 40.893,1.425 41.258,1.537 41.622,1.650 41.986,1.764 42.351,1.879 42.715,1.995 43.079))' gg, created = GeographicLocation.objects.get_or_create(geometry=WKTReader().read(geom_wkt)) self.assertTrue(created) gg, created = GeographicLocation.objects.get_or_create(geometry=WKTReader().read(geom_wkt)) self.assertFalse(created) - # Conclusion: db can't handle numbers with too many decimals (NOT NULL constraint failed) class PersonnelTests(TestCase): diff --git a/geospaas/tests.py b/geospaas/tests.py index 07978fc5..bbbf3274 100644 --- a/geospaas/tests.py +++ b/geospaas/tests.py @@ -6,11 +6,10 @@ from geospaas.utils import utils class TestUtils(TestCase): - - def test_validate_uri_opendap_does_not_exist(self): - uri = 'http://www.ifremer.fr/opendap/cerdap1/globcurrent/' \ - 'v2.0/global_012_deg/geostrophic/2014/001/' \ - '20140101000000-GLOBCURRENT-L4-CURgeo_0m-ALT_OI-v02.0-fv01.0.nc.tull' + @patch('urllib3.PoolManager') + def test_validate_uri_opendap_does_not_exist(self, mock_PoolManager): + uri = 'http://www.ifremer.fr' + mock_PoolManager.status=1 with self.assertRaises(OSError) as cm: utils.validate_uri(uri) self.assertEqual('NetCDF: file not found', cm.exception.args[1]) diff --git a/geospaas/urls.py b/geospaas/urls.py deleted file mode 100644 index 0c346f22..00000000 --- a/geospaas/urls.py +++ /dev/null @@ -1,12 +0,0 @@ -from django.conf.urls import include, url - -from django.contrib import admin -admin.autodiscover() - -app_name = 'geospaas' -urlpatterns = [ - # Examples: - # - #url(r'adas/', include('geospaas.adas_viewer.urls')), - url(r'^', include('geospaas.base_viewer.urls')), -] diff --git a/provisioning/site.yml b/provisioning/site.yml index 84564c29..36a45c41 100644 --- a/provisioning/site.yml +++ b/provisioning/site.yml @@ -20,7 +20,7 @@ - django_forms_bootstrap - leaflet django_urlpatterns: - - "path('', include('geospaas.urls'))," + - "path('', include('geospaas.base_viewer.urls'))," - role: geospaas geospaas_project_home: '{{ project_home }}'