From 094d395a9cecc479ecb7ee900f77953abe32e938 Mon Sep 17 00:00:00 2001 From: Oluwanifemi Daramola <76186151+nifedara@users.noreply.github.com> Date: Tue, 2 Apr 2024 11:23:07 +0100 Subject: [PATCH] added test set up --- backend/tests/test_core_model.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/backend/tests/test_core_model.py b/backend/tests/test_core_model.py index 58e299cb..5fc09afb 100644 --- a/backend/tests/test_core_model.py +++ b/backend/tests/test_core_model.py @@ -1,13 +1,19 @@ from django.test import TestCase -from .factories import DatasetFactory, OsmUserFactory +from .factories import DatasetFactory, OsmUserFactory, AoiFactory class TestCoreModels(TestCase): + def setUp(self): + self.user = OsmUserFactory(username="Test User 2", osm_id=123) + self.dataset = DatasetFactory(created_by=self.user) + self.aoi = AoiFactory(dataset=self.dataset) + def test_dataset_creation(self): - user = OsmUserFactory(username="Test User 2", osm_id=123) - dataset = DatasetFactory(created_by=user) + self.assertEqual(self.dataset.name, "Test Dataset") + self.assertEqual(self.dataset.created_by, self.user) - self.assertEqual(dataset.name, "Test Dataset") - self.assertEqual(dataset.created_by, user) + def test_aoi_creation(self): + self.assertEqual(self.aoi.dataset, self.dataset) + self.assertEqual(self.aoi.label_status, -1)