From faa964c686a75c93db5eca7e8a571030273637d0 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Wed, 15 May 2024 15:43:03 +0200 Subject: [PATCH] add tests --- georiviere/river/tests/test_managers.py | 15 --------------- georiviere/tests/factories.py | 3 +++ 2 files changed, 3 insertions(+), 15 deletions(-) delete mode 100644 georiviere/river/tests/test_managers.py diff --git a/georiviere/river/tests/test_managers.py b/georiviere/river/tests/test_managers.py deleted file mode 100644 index a58d77ed..00000000 --- a/georiviere/river/tests/test_managers.py +++ /dev/null @@ -1,15 +0,0 @@ -from django.test import TestCase - -from georiviere.river.models import Stream -from georiviere.river.tests.factories import StreamFactory - - -class RiverManagerTestCase(TestCase): - @classmethod - def setUpTestData(cls): - StreamFactory.create_batch(5) - - def test_truncate(self): - self.assertEqual(Stream.objects.count(), 5) - Stream.objects.truncate() - self.assertEqual(Stream.objects.count(), 0) diff --git a/georiviere/tests/factories.py b/georiviere/tests/factories.py index 15b45013..668301bd 100644 --- a/georiviere/tests/factories.py +++ b/georiviere/tests/factories.py @@ -13,8 +13,11 @@ class BaseLineStringFactory(factory.django.DjangoModelFactory): @factory.lazy_attribute def geom(self): origin_lat = 0 + origin_lon = 0 + middle_lon = 0 destination_lat = 0 middle_lat = 0 + destination_lon = 0 while origin_lat == destination_lat or middle_lat == origin_lat or destination_lat == middle_lat: origin_lat, origin_lon, *other = fake.local_latlng(country_code='FR') middle_lat, middle_lon, *other = fake.local_latlng(country_code='FR')